MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / manually_updated_meter_test

Function manually_updated_meter_test

DemoPrograms/Demo_Progress_Meters.py:106–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

104
105
106def manually_updated_meter_test():
107 # layout the form
108 layout = [[sg.Text('This meter is manually updated 4 times')],
109 [sg.ProgressBar(max_value=10, orientation='h', size=(20, 20), key='progress')]]
110
111 # create the form`
112 # must finalize since not running an event loop
113 window = sg.Window('Custom Progress Meter', layout, finalize=True)
114
115 # Get the element to make updating easier
116 progress_bar = window['progress']
117
118 # -------------------- Your Program Code --------------------
119 # Spot #1 to indicate progress
120 progress_bar.update_bar(1) # show 10% complete
121 sleep(2)
122
123 # more of your code.... perhaps pages and pages of code.
124 # Spot #2 to indicate progress
125 progress_bar.update_bar(2) # show 20% complete
126 sleep(2)
127
128 # more of your code.... perhaps pages and pages of code.
129 # Spot #3 to indicate progress
130 progress_bar.update_bar(6) # show 60% complete
131 sleep(2)
132
133 # more of your code.... perhaps pages and pages of code.
134 # Spot #4 to indicate progress
135 progress_bar.update_bar(9) # show 90% complete
136 sleep(2)
137 window.close()
138
139
140'''

Callers 1

Calls 2

closeMethod · 0.95
update_barMethod · 0.80

Tested by

no test coverage detected