Home > Blockchain >  Update default value of a Combo
Update default value of a Combo

Time:10-09

I would like to change the default value of the combo when I press the button,Is it possible to do so ?

from PySimpleGUI import *
layout=[[Combo(["Example1","Example2","Example3"],default_value='example2',key='board2')],[Button("Change")]]
wnd=Window("Test",layout)
event,values=wnd.read()
if event=="Change":
    wnd.find_element["board2"].update(default_value="example3")
else:
    wnd.close()

CodePudding user response:

wnd.find_element("board2").update(value="Example3")

If value is in values ["Example1","Example2","Example3"], DefaultValue will also change to value. But value is not in values, DefaultValue will not change.

  • Related