[pygtk] Help with set_cursor() ---- Invisible cursor option
DINESHBABU DINAKARABABU
dinesh243 at gmail.com
Tue Aug 4 03:50:51 WST 2009
Hi everyone,
I am pretty new to Python and Pygtk. I would be grateful if someone could
help me out with this issue.
I am trying to get a full screen display of an image from some raw data
using the pixbuf_new_from_data() method. I want to do away with the default
cursor option and implement an invisible cursor so that we don't see the
cursor during the full screen display. To implement the invisible cursor, I
am doing the following:
pixmap = gtk.gdk.Pixmap(None, 1, 1, 1)
color = gtk.gdk.Color()
cursor = gtk.gdk.Cursor(pixmap, pixmap, color, color, 0, 0)
gtk.gdk.Window.set_cursor(cursor)
However, I am getting this error:
TypeError: descriptor 'set_cursor' requires a 'gtk.gdk.Window' object but
receives a 'gtk.gdk.Cursor'.
It would be very helpful if someone could help me out in solving this issue.
I have included the full 'image display' script below.
#!/usr/bin/env python
import sys
import gtk
import cairo
def key_press_event(widget, event):
if event.string == 'q':
gtk.main_quit()
def expose (da, event, pixbuf):
ctx = da.window.cairo_create()
ctx.set_source_pixbuf(pixbuf,0,0)
ctx.paint()
ctx.stroke()
def main():
data = '\x63\x63\x63\x00\x00\x00\x63\x63\x63\x00\x00\x00\x63\x63\x63'
pixbuf =
gtk.gdk.pixbuf_new_from_data(data,gtk.gdk.COLORSPACE_RGB,0,8,5,1,15)
imgw=pixbuf.get_width()
imgh=pixbuf.get_height()
win = gtk.Window()
pixmap = gtk.gdk.Pixmap(None, 1, 1, 1)
color = gtk.gdk.Color()
cursor = gtk.gdk.Cursor(pixmap, pixmap, color, color, 0, 0)
gtk.gdk.Window.set_cursor(cursor)
gtk.Window.fullscreen(win)
win.connect("key-press-event", key_press_event)
win.set_default_size(imgw, imgh)
da = gtk.DrawingArea()
win.add(da)
da.connect('expose_event', expose, pixbuf)
win.show_all()
gtk.main()
main()
--
Cheers
DB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090803/fd93b427/attachment.htm
More information about the pygtk
mailing list