[Tkinter-discuss] Re: Custom cursor?

Russell E. Owen rowen at cesmail.net
Wed Mar 2 00:19:58 CET 2005

In article <20050225115427.04d8ede0.klappnase at web.de>,
 Michael Lange <klappnase at web.de> wrote:

> You have to use a tuple instead of a string (at least if you want to use a 
> two-colored cursor), like this:
> mycursor = ('@/usr/X11R6/include/X11/bitmaps/cntr_ptr', 
> '/usr/X11R6/include/X11/bitmaps/cntr_ptrmsk', 'black', white')
> t.configure(cursor=mycursor)

Thanks everybody for all the help.

In summary:
- unix, MacOS X and Windows each have a different required file format 
(the standard format for cursors on that platform). This makes 
cross-platform cursors in Tkinter a lot of work -- more than I'm ready 
to do right now.

- Unix requirements:
  - specify an xbm format file path plus at least a foreground color
    (a fancier form allows a mask and background color as well);
  - the xbm file must include hotspot info
  - the multiple args must be in a tuple

It is conceivable that if one wrote a C interface to 
Tk_GetCursorFromData, then one form of data might be acceptable to all 
platforms. I'm not ready to try that yet.


-- Russell

More information about the Tkinter-discuss mailing list