Skip to content
Permalink
Browse files

Merge pull request #1537 from PySimpleGUI/Dev-latest

A bit more commenting
  • Loading branch information...
MikeTheWatchGuy committed Jun 11, 2019
2 parents 10608ac + 8446549 commit 1f79124d6a4c6a81cec7bd08717c29c22d4d4db0
Showing with 15 additions and 9 deletions.
  1. +15 −9 DemoPrograms/Demo_Progress_Meters.py
@@ -5,23 +5,28 @@
else:
import PySimpleGUI27 as sg
from time import sleep
from sys import exit as exit


"""
Demonstration of simple and multiple OneLineProgressMeter's
Demonstration of simple and multiple OneLineProgressMeter's as well as the Progress Meter Element
There are 3 demos
1. Manually updated progress bar
2. Custom progress bar built into your window, updated in a loop
3. OneLineProgressMeters, nested meters showing how 2 can be run at the same time.
Shows how 2 progress meters can be running at the same time.
Note -- If the user wants to cancel a meter, it's important to use the "Cancel" button, not the X
If the software determined that a meter should be cancelled early,
calling OneLineProgresMeterCancel(key) will cancel the meter with the matching key
"""

# sg.ChangeLookAndFeel('Dark')


"""
The simple case is that you want to add a single meter to your code. The one-line solution
The simple case is that you want to add a single meter to your code. The one-line solution.
This demo function shows 3 different OneLineProgressMeter tests
1. A horizontal with red and white bar colors
2. A vertical bar with default colors
3. A test showing 2 running at the same time
"""

def demo_one_line_progress_meter():
@@ -78,11 +83,12 @@ def demo_one_line_progress_meter():
def manually_updated_meter_test():
# layout the form
layout = [[sg.Text('This meter is manually updated 4 times')],
[sg.ProgressBar(10, orientation='h', size=(20,20), key='progress')]]
[sg.ProgressBar(max_value=10, orientation='h', size=(20,20), key='progress')]]

# create the form`
window = sg.Window('Custom Progress Meter', layout).Finalize()
progress_bar = window.FindElement('progress')
window = sg.Window('Custom Progress Meter', layout).Finalize() # must finalize since not running an event loop

progress_bar = window.FindElement('progress') # Get the element to make updating easier

# -------------------- Your Program Code --------------------
# Spot #1 to indicate progress

0 comments on commit 1f79124

Please sign in to comment.
You can’t perform that action at this time.