Moving a window on the screen
Terry Reedy
tjreedy at udel.edu
Thu Nov 6 04:25:16 EST 2014
On 11/6/2014 3:57 AM, Chris Angelico wrote:
> On Thu, Nov 6, 2014 at 7:32 PM, ast <nomail at invalid.com> wrote:
>> The fen window goes from it's initial location to the last one
>> but we dont see all the intermediate steps
>
> You usually don't want to use time.sleep() in a GUI program. Try doing
> the same thing, but with an event loop delay call instead; often, the
> display won't update until you go back to the main loop.
import tkinter as tk
root = tk.Tk()
x = 0
def march():
global x
print(x)
root.geometry("200x200+%d+%d" % (x,x))
x += 10
if x < 200:
root.after(300, march)
march()
root.mainloop()
--
Terry Jan Reedy
More information about the Python-list
mailing list