Hello i try to lean python and i have difficulty for create widget ,
import console
import clipboard
import ui
import appex, ui
mv = ui.View(frame=(0,0,320,420))
mv.background_color = 'black'
def num_inp(sender):
if sender.title == 'next':
sender.active = 1 + sender.active
return
tf_idx = sender.superview['nf'].active
tf = sender.superview[['brut','long','nb'][tf_idx]]
tf.text += sender.title
l1 = ui.Label()
l1.text = 'brut:'
l1.frame = (67,2,50,20)
l1.text_color = '#ffffff'
mv.add_subview(l1)
l2 = ui.Label()
l2.text = 'long:'
l2.frame = (65,25,50,20)
l2.text_color = '#ffffff'
mv.add_subview(l2)
l3 = ui.Label()
l3.text = 'nb:'
l3.frame = (77,48,50,20)
l3.text_color = '#ffffff'
mv.add_subview(l3)
l4 = ui.Label()
l4.text ='palette:'
l4.frame = (67,71,110,20)
l4.text_color = '#ffffff'
mv.add_subview(l4)
l5 = ui.Label()
l5.text = 'rouleau:'
l5.frame = (64,94,110,20)
l5.text_color = '#ffffff'
mv.add_subview(l5)
t1 = ui.TextField(name='brut')
t1.frame = (105,2,70,20)
mv.add_subview(t1)
t2 = ui.TextField(name='long')
t2.frame = (105,25,70,20)
mv.add_subview(t2)
t3 = ui.TextField(name='nb')
t3.frame = (105,48,70,20)
mv.add_subview(t3)
for i in range(0,5):
b = ui.Button()
b.action = num_inp
b.title = str(i)
b.frame = (180+i*40,0,54,50)
b.font = ("<system>",36)
b.background_color = '#949494'
mv.add_subview(b)
for j in range(5,10):
b = ui.Button()
b.action = num_inp
b.title = str(j)
b.frame = (-20+j*40,50,54,50)
b.font = ("<system>",36)
b.background_color = '#949494'
mv.add_subview(b)
nf =ui.Button(name='nf')
nf.title = 'next'
nf.font = ("<system>",20)
nf.background_color ='#c5c5c5'
nf.action = num_inp
nf.active = 0
nf.frame = (5,5,50,30)
mv.add_subview(nf)
appex.set_widget_view(mv)




