Forum Archive

Syntax Error calculator

sendog3c

Hello here:

My code is presenting a syntax error. I have done all in possibilities to fix it but have been impossible to find what is happening.

I appreciate your help.

Regards

```
import ui

w, h = ui.get_screen_size()

bw = 0
bh = 0
color1 = ''
equis = 60
yee = 140
ancho = 100
alto = 100
posicion = equis, yee, ancho, alto
bg_color1 = '#656ba9'

def button_tapped(sender):
label.bg_color = sender.bg_color
label.text = sender.title
label.text_color = sender.tint_color

def make_button(color1, title, posicion):
button = ui.Button(
action=button_tapped,
alignment=ui.ALIGN_CENTER,
#bg_color=title.lower(),
background_color = bg_color1,
border_color='black',
border_width=1,
frame=(posicion),
tint_color='white',
title=title,
corner_radius = 5)

# it seems to be necessary to reset the frame
#button.frame = (screen_x, h - 600, bw, bh)
return button

label = ui.Label(
alignment=ui.ALIGN_CENTER,
bg_color='silver',
background_color='black',
border_width=1,
frame=(10, 50, 180, 60),
name='Label')

button1 = make_button(title ='SUM', background_color='#a93d17', frame=(posicion))
button2 = make_button(title='SUBS', background_color='#7ca917', frame=(posicion))
button3 = make_button(title = 'MULT', background_color='#1770a9', frame=(posicion))
button4 = make_button(title = 'DIV', background_color='#7c17a9', frame=(posicion)

view = ui.View(name='MATHGICIAN', background_color='#7f7f7f', frame=(10,10,400,700))
view.add_subview(label)
view.add_subview(button1)
view.add_subview(button2)
view.add_subview(button3)
view.add_subview(button4)
view.present('screen')```

mikael

@sendog3c, missing closing parenthesis on line 49.