[Tkinter-discuss] Custom cursor?

Stewart Midwinter stewart.midwinter at gmail.com
Fri Feb 25 00:08:24 CET 2005


Actually on Windows it gives an exception but you're probably close on
the config options.

Traceback (most recent call last):
  File "test-cursor.py", line 3, in ?
    t.configure(cursor="@cntr_ptr cntr_ptrmsk black white")
  File "C:\Programs\Python24\Lib\lib-tk\Tkinter.py", line 1139, in configure
    return self._configure('configure', cnf, kw)
  File "C:\Programs\Python24\Lib\lib-tk\Tkinter.py", line 1130, in _configure
    self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: bad cursor spec "@cntr_ptr cntr_ptrmsk black white"


On Thu, 24 Feb 2005 16:00:21 -0600, Jeff Epler <jepler at unpythonic.net> wrote:
> On my Linux machine, this worked in wish:
> $ cd /usr/X11R6/include/X11/bitmaps
> $ wish
> % . configure -cursor {@cntr_ptr cntr_ptrmsk black white}
> 
> The Python version would probably read something like
>     import Tkinter
>     t = Tkinter.Tk()
>     t.configure(cursor="@cntr_ptr cntr_ptrmsk black white")
>     t.mainloop()
> I suspect the 1-arg format "@example.cur" should work just as well on
> Windows.
> 
> Tk_GetCursorFromData is a C API, while Tkinter mostly exposes the Tcl
> API.  Reading the Tk_GetCursorFromData manual page, it looks like it
> doesn't expose any capabilities that the @-form of the cursor property
> doesn't (instance, the X and Y hotspots are named in the "cntr_ptr"
> file), but maybe I'm missing something.
> 
> Jeff
> 
> 
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
> 
> 
> 
> 


-- 
Stewart Midwinter
stewart at midwinter.ca
stewart.midwinter at gmail.com


More information about the Tkinter-discuss mailing list