New demo that shows how to use new spinner change submits capability
This commit is contained in:
parent
310fe845e4
commit
b7c095d9c0
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
# Testing async form, see if can have a spinner
|
||||||
|
# that adjusts the size of text displayed
|
||||||
|
|
||||||
|
import PySimpleGUI as sg
|
||||||
|
|
||||||
|
form = sg.FlexForm("Font size selector")
|
||||||
|
|
||||||
|
fontSize = 12
|
||||||
|
sampleText = sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize))
|
||||||
|
layout = [
|
||||||
|
[sampleText, sg.Spin([sz for sz in range(4,72)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin')],
|
||||||
|
[sg.OK(), sg.Cancel()]
|
||||||
|
]
|
||||||
|
|
||||||
|
sz = fontSize
|
||||||
|
form.Layout(layout)
|
||||||
|
while True:
|
||||||
|
button, values= form.Read()
|
||||||
|
if button is None:
|
||||||
|
break
|
||||||
|
sz = int(values['spin'])
|
||||||
|
if sz != fontSize:
|
||||||
|
fontSize = sz
|
||||||
|
font = "Helvetica " + str(fontSize)
|
||||||
|
sampleText.Update(font=font)
|
||||||
|
|
||||||
|
print("Done.")
|
Loading…
Reference in New Issue