Hello:
My script is presenting a syntax error in the line 23. What I want is to show a main view as an introduction of the app I am creating. I am a beginner so appreciate any help. As you can see there are a lot # for comments because is the way I am experimenting. Thanks
The error is in this :
vanimation.add_subview(labelmain)
import ui
import console
import sqlite3
conn = sqlite3.connect(":memory:")
c = conn.cursor()
# Create table
c.execute('''CREATE TABLE IF NOT EXISTS logindata (date_login, user_name, pwd_user)''')
# Insert a row of data
#c.execute("INSERT INTO stocks VALUES ('2006-01-05','BUY','RHAT',100,35.14)")
# Save (commit) the changes
conn.commit()
# We can also close the connection if we are done with it.
# Just be sure any changes have been committed or they will be lost.
#global icontador
vanimation=ui.View(frame = (0,0,800,800), bg_color = '#34d1bd', name = 'Habitfun Init')
labelmain = ui.Label(alignment=ui.ALIGN_CENTER,bg_color='#fafafa',border_color='black',border_width=1,frame=(100, 150, 300, 40),name='labelmain',text='WELCOME TO HABITfun, text_color = '#0d60fd')
vanimation.add_subview(labelmain)
vanimation.present('sheet')
def button1_tapped(sender):
sender.superview.close()
def button2_tapped(sender):
alert_result = console.alert('Title', 'HOLA MARIANA, BUENOS DIAS', 'Button 1', 'Button 2')
button1 = ui.Button(title = 'SALIR', alignment=ui.ALIGN_CENTER, bg_color = '#ff1a55', font_color = 'black')
button1.frame = (100,400,100,50)
button1.tint_color = 'black'
button1.border_width = 1
button1.action = button1_tapped
button2 = ui.Button(title = 'ACEPTAR', alignment=ui.ALIGN_CENTER, bg_color = '#ff1a55', font_color = 'black')
button2.frame = (300,400,100,50)
button2.tint_color = 'black'
button2.border_width = 1
button2.action = button2_tapped
label1 = ui.Label(alignment=ui.ALIGN_CENTER,bg_color='#fafafa',border_color='black',border_width=1,frame=(100, 150, 300, 40),name='User',text='User Name', text_color = '#0d60fd')
label2 = ui.Label(alignment=ui.ALIGN_CENTER,bg_color='#fafafa',border_color='black',border_width=1,frame=(100, 250, 300, 40),name='Password',text='Password', text_color = '#0d60fd')
t1=ui.TextField(frame=(100,200,300,40))
t2=ui.TextField(frame=(100,300,300,40))
t1.begin_editing()
v=ui.View(name='Habitfun', bg_color='#545fd1',frame=(0,0,500,500))
v.add_subview(label1)
v.add_subview(label2)
v.add_subview(button1)
v.add_subview(button2)
v.add_subview(t1)
v.add_subview(t2)
def tfaction(textfield):
'''when you change the textfield, and press return, this metjod is called'''
print('textfield changed:', textfield.text )
t1.action=tfaction
v.present('sheet')
