Merge pull request #3928 from PySimpleGUI/Dev-latest

New Demo - Progress meter simulation
This commit is contained in:
PySimpleGUI 2021-02-19 15:07:15 -05:00 committed by GitHub
commit 2e43dc16d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 0 deletions

View File

@ -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()