Python:Tkinter -- How do I get cursor to show busy status
python, tkinter
Solution
Make `do_something` like this:
def do_something():
print "starting"
root.config(cursor="watch")
root.update()
time.sleep(5)
root.config(cursor="")
print "done"
Basically, I did three things:
Replaced `window` with `root` (since `window` isn't defined and `root` is the window's handle).
Added `root.update()` just after the line that configures the cursor.
Removed the unnecessary `return` (this didn't cause any errors, but why have it?).
Problem
I'm trying to make Tkinter show a busy cursor. Unfortunately, I must be missing something terribly obvious. Following is a very simple program that reproduces my problem: ``` from Tkinter import * import time def do_something(): print "starting" window.config(cursor="wait") time.sleep(5) window.config(cursor="") print "done" return root = Tk() menubar = Menu(root) filemenu = Menu(menubar, tearoff=0) filemenu.add_command(label="Do Something", command=do_something) filemenu.add_command(label="Exit", command=root.quit) menubar.add_cascade(label="File", menu=filemenu) root.config(menu=menubar) root.mainloop() ``` I'm not seeing any change in the cursor