Jun-10-2019, 03:15 AM
(This post was last modified: Jun-10-2019, 03:15 AM by Soundtechscott.)
I am looking for a way to use a PYSimpleGUI progress bar... without a loop
I have looked for several days on the internet with no luck to find an example.
seems everybody does their example with a loop, or on a timer.
I'd like to do something more like a definition that I Can call to to update
I dont know what to change to make it a manually updated item...
I want to be able to tell it i=0 at the beginning of my script
and periodically place update marks thru the script(i=i+4)
so that I can update it as each Major Step in my script is done
This is the PySimpleGUI script, plus some lines showing what I want to do
This currently auto iterates...and I do not know how to change it
I'm just trying to learn and cant find any examples online to do what I want to do.
I have looked for several days on the internet with no luck to find an example.
seems everybody does their example with a loop, or on a timer.
I'd like to do something more like a definition that I Can call to to update
I dont know what to change to make it a manually updated item...
I want to be able to tell it i=0 at the beginning of my script
and periodically place update marks thru the script(i=i+4)
so that I can update it as each Major Step in my script is done
This is the PySimpleGUI script, plus some lines showing what I want to do
This currently auto iterates...and I do not know how to change it
I'm just trying to learn and cant find any examples online to do what I want to do.
import PySimpleGUI as sg import time from time import sleep #With this example... It Just auto runs from 0 to completion... this is not what I want to do, but this is teh example the creator gives def CustomMeter(): layout = [[sg.Text('A custom progress meter')], [sg.ProgressBar(1000, orientation='h', size=(20,20), key='progress')], [sg.Cancel()]] window = sg.Window('Custom Progress Meter').Layout(layout) progress_bar = window.FindElement('progress') for i in range(1000): event, values = window.Read(timeout=0) if event == 'Cancel' or event == None: break progress_bar.UpdateBar(i+1) window.Close() prog() time.sleep(2) #______________________________________________________________ #I'd like to be able to do this #i=0 at this point prog() #do Scripty Stuff #Update Progress Bar Manually #i=4 at this point #do more scriptic writings #Update Progress bar Manually #i=8 at this point #and so forth and so on until I reach 100