New demo that shows how to use new spinner change submits capability

This commit is contained in:
MikeTheWatchGuy 2018-08-31 09:10:15 -04:00
parent 310fe845e4
commit b7c095d9c0
1 changed files with 28 additions and 0 deletions

28
Demo_Font_Sizer.py Normal file
View File

@ -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.")