Search code examples
pythontkintermouse-cursor

TkInter: how to display the normal cursor?


I have a simple TkInter interface where, after a button click, the cursor of the mouse is changed to fleur. Now, after the task using this cursor is done, I want to use a normal cursor. By normal I mean the cursor you see now on your own computer.

I checked the list of available cursors here but no one of them looks normal.

Is there any way to set back the mouse pointer to a normal cursor ?

Thank you in advance


Solution

  • To go back to the standard cursor, pass an empty string to cursor:

    root.config(cursor='')
    

    For example:

    from Tkinter import *
    
    def cursor():
        if not root.cget('cursor') == '':
            root.config(cursor='')
        else:
            root.config(cursor='fleur')
    
    root = Tk()
    Button(root, text='Change cursor', command=cursor).pack()
    root.mainloop()