diff --git a/DemoPrograms/Demo_Spin_Element_Wraps_Around.py b/DemoPrograms/Demo_Spin_Element_Wraps_Around.py index 53d8216e..5b1c3936 100644 --- a/DemoPrograms/Demo_Spin_Element_Wraps_Around.py +++ b/DemoPrograms/Demo_Spin_Element_Wraps_Around.py @@ -10,16 +10,17 @@ import PySimpleGUI as sg This Spin element will wrap around going in either direction. When getting to the end then it will go back to the beginning. - Copyright 2021 PySimpleGUI + Copyright 2022 PySimpleGUI """ lower, upper = 0, 10 data = [i for i in range(lower - 1, upper + 2)] -layout = [[sg.Spin(data, initial_value=lower, readonly=True, size=3, enable_events=True, key='-SPIN-')]] +layout = [[sg.Text('This Spin element wraps around in both directions')], + [sg.Spin(data, initial_value=lower, readonly=True, size=3, enable_events=True, key='-SPIN-')]] -window = sg.Window('Title', layout, font='_ 18') +window = sg.Window('Wrapping Spin Element', layout, font='_ 18', keep_on_top=True) while True: @@ -27,7 +28,7 @@ while True: if event == sg.WIN_CLOSED: break - + # code to make the Spin do the wrap around. Do this prior to using the Spin's value in your code if event == '-SPIN-': value = values['-SPIN-'] @@ -38,6 +39,6 @@ while True: window['-SPIN-'].update(value=lower) values['-SPIN-'] = lower # Change the values dictionary too so it'll be correct if used - print(values['-SPIN-']) + sg.Print('Spin Value:', values['-SPIN-'], relative_location=(-400, 0)) window.close() \ No newline at end of file