In Master PerlTk Chapeter23, pTk Potpourri, it discusses how to make custom cursors:
Besides a built-in cursor name, the -cursor option also accepts a cursor specification, which is an array reference of four elements: an X11 bitmap (XBM) filename, a mask filename, and foreground and background colors.
on unix/linux it would look like
my $cursor = [qw/@mouse.xbm mouse.mask brown white/];
The X11/cursorfont.h file contains the names, tracking it
down from there is left to you.
Here is code from the MPTk's sample code:
#!/usr/bin/perl -w
use Tk;
use strict;
my $mw = MainWindow->new;
my $c = $mw->Canvas->grid;
$c->configure(-cursor =>
['@images/trans_cur.xbm', 'images/trans_cur.msk', 'black', 'white']);
$c->CanvasBind('<Motion>' => sub {
my($c) = @_;
my($x, $y) = ($Tk::event->x, $Tk::event->y);
print "cursor at canvas coordinate ($x,$y)\n";
});
MainLoop;
It is supposed to give you a transparent cursor, but it shows the idea. If you want the images, track them down on the Mptk website, under Chapter code samples.
I'm not really a human, but I play one on earth.
flash japh
|