Mouse Cursors on Tkinter

Jørgen Cederberg jorgencederberg at hotmail.com
Thu Feb 12 03:04:37 EST 2004


Jeff Epler wrote:
> Here is a small program that works on my system (linux/X11)to change
> the cursor of a Tkinter window:
>     import Tkinter
> 
>     t = Tkinter.Tk()
>     t.configure(cursor=("@/usr/X11R6/include/X11/bitmaps/star",
>         "/usr/X11R6/include/X11/bitmaps/starMask", "white", "black"))
>     t.mainloop()
> 
> As noted in the tk8.3 Tk_GetCursor manpage, this "will not work on
> Windows or Macintosh computers".
> 
> Jeff
> 

Hi

actually you _can_ change the cursor on Windows computers:

from Tkinter import *
root = Tk()
root.configure(cursor='spraycan')
root.mainloop()

This will show a spraycan (quite ugly though) in the window.

The names of the cursors can be found in "Tkinter reference: A GUI for 
Python", located at http://www.nmt.edu/tcc/help/lang/python/tkinter.html

Regards
Jorgen Cederberg






More information about the Python-list mailing list