Claus1 / unigui

Universal GUI Framework and Protocol (Python)
MIT License
76 stars 4 forks source link

why my text not change . when textfield is updated #6

Closed bobwatcherx closed 1 year ago

bobwatcherx commented 1 year ago

why my txt2 not change this

mycode

from unigui import *

txt2 = Text('Text about dog')

def gantinama(_,value):
    print(value)
    txt2.value = value

eblock = Block('test',                        
        [
        Edit("ganti nama","",changed=gantinama),
        ]
        )

config_area = [eblock,txt2]
Claus1 commented 1 year ago

a handler has to return the changed object. so in your case it is

return txt2

config_area is not connected to 'blocks' variable of screen. all gui objects has to be in blocks. In you case instead config_area write

blocks = [eblock] 

or the same

config_area = [eblock]  
blocks =  config_area 

eblock has to include txt2. or another block has.

So always logic structure is Screen -> blocks -> gui objects.