Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Root797675yTangentially related:
I remember discovering that a VB project may only call sleep() in exactly one place in the code; any second reference to it throws an error, I believe? Or maybe just doesn't work at all; idr. But if you make a "sub" (or whatever is VB for method) that contains your one allotted sleep() call and use that everywhere, it works just fine. GG -
Parzi86635y@Root on python after a nondescript number of uses time.sleep() just gets undefined sometimes.
-
Because that's how the event loops work.
You block the main thread with your callback function (which is a bad idea in most GUI frameworks).
The Tkinter event loop is following (simplified):
(Wait for event) -> call event functions -> redraw graphics -> (Wait for event) -> ...
This means if your event handlers take a long time, it will not update the graphics.
In your case - as you seem to ignore the results of os.system anyway - why not start the subprocess with functions from the subprocess module? There are some functions in this module where you don't have to wait for the subprocess and the execution (and graphical update) immediately continues. -
Parzi86635y@sbiewald it's an example program, i really don't care about it, it's just annoying. I'll keep that in mind for later, tho.
-
I have yet to see a documentation that tells you what it does immediately and what as a later stage in the mainloop.
aight cool so this is fucking stupid thanks Tk
my python teacher is putting us through Tkinter right after "this is how to do basic math" in a class meant for those with no programming knowledge at all
and i remember now why i only do CLI
i've got 2 lines in a func (because "command" params in Tk are fucking retarded), the first changes the text on a button and then the second does shit with os.system ("have this button change this other button then do *something*" ok sure) and yet the button's text does not update until AFTER THE OS.SYSTEM COMMAND FINISHES. I can't even insert a moment between them for it to update in case it needs a sec as time.sleep does *FUCK ALL*
fuck tk, luckily we're gonna move on to files next
(goddamn prereqs, sticking me in this shitty class...)
rant