New PopupNoButtons box, added "key" to all elements, form.FindElement method, Combo.Update can update list of allowed values,
This commit is contained in:
parent
716511b887
commit
50a69f25fc
3 changed files with 69 additions and 31 deletions
|
@ -7,11 +7,11 @@ import PySimpleGUI as sg
|
|||
form = sg.FlexForm("Font size selector")
|
||||
|
||||
fontSize = 12
|
||||
sampleText = sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize))
|
||||
slider = sg.Slider(range=(6,50), orientation='h', size=(10,20), change_submits=True, key='slider')
|
||||
spin = sg.Spin([sz for sz in range(4,72)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin')
|
||||
|
||||
layout = [
|
||||
[sampleText, spin, slider],
|
||||
[sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text'),
|
||||
sg.Spin([sz for sz in range(6, 72)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True,
|
||||
key='spin'), sg.Slider(range=(6,50), orientation='h', size=(10,20), change_submits=True, key='slider')],
|
||||
[sg.OK(), sg.Cancel()]
|
||||
]
|
||||
|
||||
|
@ -25,11 +25,10 @@ while True:
|
|||
sz_slider = int(values['slider'])
|
||||
sz = sz_spin if sz_spin != fontSize else sz_slider
|
||||
if sz != fontSize:
|
||||
print(sampleText.Font, sampleText.Size)
|
||||
fontSize = sz
|
||||
font = "Helvetica " + str(fontSize)
|
||||
sampleText.Update(font=font)
|
||||
slider.Update(sz)
|
||||
spin.Update(sz)
|
||||
form.FindElement('text').Update(font=font)
|
||||
form.FindElement('slider').Update(sz)
|
||||
form.FindElement('spin').Update(sz)
|
||||
|
||||
print("Done.")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue