Ren'Py [SOLVED]ToggleDict

GoldenD

Member
Sep 30, 2018
102
70
The first sample bottom is ok but list_select is fixed. The second, I would, dynamically assign values in list_select but no reaction when I click on buttons.
Common Code
Python:
style checkbox_button:
    xysize (100, 100)
    background Solid("#ffff00")                     # YELLOW    UNCHECKED
    hover_background Solid("#ffffff")               # WHITE     UNCHECKED HOVERED
    selected_idle_background Solid("#00ff00")       # GREEN     CHECKED
    selected_hover_background Solid("#6d0002")      # RED       CHECKED HOVERED

label start:
    call screen test
First sample ok
Python:
default list_select  = {0:False,1:False,2:False,3:False}
   
screen test():
    $ x_pos = 300
    for idx in range(len(list_select)):
        textbutton "Item [idx]"  xpos x_pos:
            action ToggleDict( list_select, idx, True, False )
            style "checkbox_button"
        $x_pos +=100
Second sample doesn'twork
Python:
default list_select  = dict()

screen test():
    $ x_pos = 300

    for idx in range (4):
        $ list_select[idx] = False

    for idx in range(len(list_select)):
        textbutton "Item [idx]"  xpos x_pos:
            action ToggleDict( list_select, idx, True, False )
            style "checkbox_button"
        $x_pos +=100
And I don't understand why ?
 
Last edited: