[pygtk] PyGTK cursor images/snapshots

Aravind Vijayakumar iamfenris at yahoo.com
Thu Apr 12 20:22:41 WST 2007


Hi all,



It looks like the documentation shipped with PyGTK doesn't have the .png images for the various cursor types. Neither does the documentation on pygtk.org. I whipped up a small script to allow the user to see the different cursors. Hope it's useful for someone other than me!


-Aravind


PS I'm running Python 2.5, GTK+ 2.10.9 and PyGTK 2.10.4 -- haven't tested with earlier versions.

#!/usr/local/bin/python

import gtk
curses = ["X_CURSOR", "ARROW", "BASED_ARROW_DOWN",
          "BASED_ARROW_UP", "BOAT", "BOGOSITY",
          "BOTTOM_LEFT_CORNER", "BOTTOM_RIGHT_CORNER", "BOTTOM_SIDE",
          "BOTTOM_TEE", "BOX_SPIRAL", "CENTER_PTR",
          "CIRCLE", "CLOCK", "COFFEE_MUG",
          "CROSS", "CROSS_REVERSE", "CROSSHAIR",
          "DIAMOND_CROSS", "DOT", "DOTBOX",
          "DOUBLE_ARROW", "DRAFT_LARGE", "DRAFT_SMALL",
          "DRAPED_BOX", "EXCHANGE", "FLEUR",
          "GOBBLER", "GUMBY", "HAND1",
          "HAND2", "HEART", "ICON",
          "IRON_CROSS", "LEFT_PTR", "LEFT_SIDE",
          "LEFT_TEE", "LEFTBUTTON", "LL_ANGLE",
          "LR_ANGLE", "MAN", "MIDDLEBUTTON",
          "MOUSE", "PENCIL", "PIRATE",
          "PLUS", "QUESTION_ARROW", "RIGHT_PTR",
          "RIGHT_SIDE", "RIGHT_TEE", "RIGHTBUTTON",
          "RTL_LOGO", "SAILBOAT", "SB_DOWN_ARROW",
          "SB_H_DOUBLE_ARROW", "SB_LEFT_ARROW", "SB_RIGHT_ARROW",
          "SB_UP_ARROW", "SB_V_DOUBLE_ARROW", "SHUTTLE",
          "SIZING", "SPIDER", "SPRAYCAN",
          "STAR", "TARGET", "TCROSS",
          "TOP_LEFT_ARROW", "TOP_LEFT_CORNER", "TOP_RIGHT_CORNER",
          "TOP_SIDE", "TOP_TEE", "TREK",
          "UL_ANGLE", "UMBRELLA", "UR_ANGLE",
          "WATCH", "XTERM"]

def change_cursor(button):
    global window
    c = gtk.gdk.Cursor(gtk.gdk.__dict__[button.get_label()])
    window.window.set_cursor(c)
    
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
table = gtk.Table(14,6,True)
window.add(table)
for idx,curse in enumerate(curses):
    button = gtk.Button(curse)
    button.set_use_underline(False)
    button.connect("clicked", change_cursor)
    cl = idx % 6
    rt = idx / 6
    table.attach(button,cl,cl+1,rt,rt+1)
    button.show()
quit_button = gtk.Button("Quit")
quit_button.connect("clicked",gtk.main_quit)
table.attach(quit_button,0,6,13,14)
quit_button.show()
table.show()
window.show()
gtk.main()








       
____________________________________________________________________________________
Now that's room service!  Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097


More information about the pygtk mailing list