diff --git a/DemoPrograms/Demo_Progress_Meter_Simulated.py b/DemoPrograms/Demo_Progress_Meter_Simulated.py new file mode 100644 index 00000000..00fc5dfd --- /dev/null +++ b/DemoPrograms/Demo_Progress_Meter_Simulated.py @@ -0,0 +1,32 @@ +""" + Demo Program - Progress Meter using a Text Element + + This program was written by @jason990420 + + This is a clever use of a Text Element to create the same look + and feel of a progress bar in PySimpleGUI using only a Text Element. + + Copyright 2020 PySimpleGUI.org +""" + +import PySimpleGUI as sg + +sg.theme('DarkBlue') + +layout = [[sg.Text('', size=(50, 1), relief='sunken', font=('Courier', 11), + text_color='yellow', background_color='black',key='-TEXT-', metadata=0)]] + +window = sg.Window('Title', layout, finalize=True) + +text = window['-TEXT-'] + +while True: + + event, values = window.read(timeout=100) + + if event == sg.WINDOW_CLOSED: + break + text.metadata = (text.metadata + 1) % 51 + text.update('█' * text.metadata) + +window.close() \ No newline at end of file