On Sat, 2002-02-23 at 05:12, vincy wrote: > i want to make some buttons w/ my own pixmap rather than those stock ones.. > can i do that? YES
Here is some example functions:
def add_button_icon_pixmap(gtk_button, pixmap, orientation='left'):
gtk_button.realize()
label = GtkLabel(gtk_button.children()[0].get())
gtk_button.remove(gtk_button.children()[0])
if orientation in ('left', 'right'):
box = GtkHBox(spacing=5)
else: # orientation in ('top', 'bottom')
box = GtkVBox(spacing=5)
if orientation in ('left', 'top'):
box.pack_start(pixmap, FALSE, FALSE, 0)
box.pack_start(label, FALSE, FALSE, 0)
else: # orientation in ('right, 'bottom')
box.pack_start(label, FALSE, FALSE, 0)
box.pack_start(pixmap, FALSE, FALSE, 0)
hbox = GtkHBox()
hbox.pack_start(box, TRUE, FALSE, 0)
hbox.show_all()
gtk_button.add(hbox)
def add_button_icon(gtk_button, file, orientation='left'):
gtk_button.realize()
window = gtk_button.get_parent_window()
xpm, mask = create_pixmap_from_xpm(window, None, PIXMAP_PATH + file)
pixmap = GtkPixmap(xpm, mask)
add_button_icon_pixmap(gtk_button, pixmap, orientation)
# add a GNOME STOCK ICON to a button
def add_button_stock_icon(gtk_button, stock_icon, orientation='left'):
pixmap = gnome.ui.GnomeStock(stock_icon)
add_button_icon_pixmap(gtk_button, pixmap, orientation)
--
Val�ry Febvre / Easter-Eggs Sp�cialiste GNU/Linux
44-46 rue de l'Ouest - 75014 Paris - France - M�tro Gait�
Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76
mailto:[EMAIL PROTECTED] - http://www.easter-eggs.com
9E9C2B24 - 91EB 2878 A4BF D149 90C7 4090 9415 8B9F 9E9C 2B24
signature.asc
Description: This is a digitally signed message part
