Python coding question....
MikeTheWatchGuy opened this issue · comments
I would like to compress the sgui.ProgressMeter widget down so that it has a single call.
Currently it;.s
meter = sgui.ProgressMeterCreate(....)
loop...
not_cancelled = sgui.ProgressMeterUpdate(...)
end loop
I would like to propose this instead
loop...
not_cancelled = sgui.ProgressMeterUpdate(...)
end loop
No create call.
I want the code in ProgressMeterUpdate to call the Create function is the meter is not created yet. If it is, then it just needs to update it.
How can I know if this is the first call to a function? Would 'nested functions' be of help as a way to save state?
I'm searching for 1-liner anywhere I can make them
I am getting help with this on StackOverflow. The 'Correct' answer was just posted.
I was looking for the 'decorator' solution. It turned out to be damned complicated looking.
I want to be multi-threaded in the future.
I'm multi-processed at the moment which is good enough for me.
The reason for this push of mine for 1-line solution is that even with tqdm, I find adding 2 lines of code to instrument a section is a barrier at times.
The new API call is simply sgui.ProgressBar(title, msg, currentItemNumber, totalNumberItems)
and it can be placed in any loop basically.
This can be closed...