python - How to get scalebars continously output inside a while loop tkinter -
I programmed a guinea with a typiler and applied a scalebar to change a variable. I am trying to get the output of this scalebar inside the one-time loop.
My code stuck and I can not change the scalab when I am inside the loop And I had to be forced to leave my code
I hope you have any idea! The code example is below, if you need more or overall source code then let me know
best regards,
intake death
class FunctionClassTest: def __init __ (self): pass def intimeSTOP (self): self.Test = wrong def intime (self): self.test = true while self.test: self.TestTmp = scalebarTime.get () if self.TestTmp & Lt; 0: ... playwriter ... online = function classista () button c = button (window, text = "test on", command = online. Intime) button d = button (window, text = "test of", command = Online IntimeSTOP)
The problem is while loop it fights with the tanker loop and Locks the GUI effectively, while continuously executing the loop, making the GUI unresponsive. Here is an example:
class app (frame): def __init __ (self, if you have a handful of options, Guardian): frame .__ init __ (self, parent) self.timer = none # timer variable self Slyide = Scale (self) self.slide.pack () button (auto, text = 'go', command = self. _start). Pack () button (self, text = 'stop', command = self._stop). Pack () Def _start (self): If self.slide.get ()> 0: # ... here the code ... i.e., print self.slide.get () # after the set timer method, call it every 1000ms self.timer = self.after (1000, self._start) def _stop ( Self: If there is no self.timer: #cancel timer, automatic .twm (self.timer) root = Tk () app = app (root) app.pack () root.mainloop () _start method with looping For more information on blocking
: For more information on the after
method.
Comments
Post a Comment