Tkinter cursor question

Michael Peuser mpeuser at web.de
Sun Sep 21 05:41:59 EDT 2003


"Gary Richardson" <garyr at fidalgo.net> schrieb im Newsbeitrag
news:vmq6a09ffl4c4 at corp.supernews.com...
> I would like to define a new cursor for use on a Canvas (other than one of
> those listed in Appendix F of "Python and Tkinter Programming"). A search
on
> Google turned up one bit of code that seemed promising. A slightly
> simplified version is shown below. This code attempts to eliminate the
> cursor by defining an invisible one, which is not what I want, but I
thought
> it might be a start. However, it doesn't run; the statement t = Text(...)
> generates an error message: TclError: bad cursor spec "@testcursor white".
> The testcursor file is being created in the current directory.


This is rather tricky - you will have to look through Tcl manuals, e.g.:

http://dev.scriptics.com/man/tcl8.3/TkLib/GetCursor.htm


You find there:

@sourceName maskName fgColor bgColor
    In this form, sourceName and maskName are the names of files describing
cursors for the cursor's source bits and mask. Each file must be in standard
X11 or X10 cursor format. FgColor and bgColor indicate the colors to use for
the cursor, in any of the forms acceptable to Tk_GetColor. This form of the
command will not work on Macintosh or Windows computers.

@sourceName fgColor
    This form is similar to the one above, except that the source is used as
mask also. This means that the cursor's background is transparent. This form
of the command will not work on Macintosh or Windows computers.

@sourceName
    This form only works on Windows, and will load a Windows system cursor
(.ani or .cur) from the file specified in sourceName.

Kindly
MichaelP






More information about the Python-list mailing list