()
| 144 | |
| 145 | |
| 146 | def custom_meter_example(): |
| 147 | # layout the form |
| 148 | layout = [[sg.Text('A typical custom progress meter')], |
| 149 | [sg.ProgressBar(1, orientation='h', size=(20, 20), key='progress')], |
| 150 | [sg.Cancel()]] |
| 151 | |
| 152 | # create the form` |
| 153 | window = sg.Window('Custom Progress Meter', layout) |
| 154 | progress_bar = window['progress'] |
| 155 | # loop that would normally do something useful |
| 156 | for i in range(10000): |
| 157 | # check to see if the cancel button was clicked and exit loop if clicked |
| 158 | event, values = window.read(timeout=0) |
| 159 | if event == 'Cancel' or event == None: |
| 160 | break |
| 161 | # update bar with loop value +1 so that bar eventually reaches the maximum |
| 162 | progress_bar.update_bar(i+1, 10000) |
| 163 | # done with loop... need to destroy the window as it's still open |
| 164 | window.close() |
| 165 | |
| 166 | |
| 167 | ''' |
no test coverage detected