Thanks You Gustavo! your info i helping me a lot and also is a good point to check having now the reference manual from

http://yang.inescn.pt/~gjc/pygtk2reference/

ivan hernandez

Gustavo J. A. M. Carneiro wrote:

A Qui, 2003-10-30 �s 15:27, Ivan Hernandez escreveu:


hello. i had been working a little with pygtk, and i haven't found a way to make a pixmap "scale" to an arbitrary size.
i mean this... i have my button with an image, let's say...



Very roughly, the solution is among these lines. Look into http://yang.inescn.pt/~gjc/pygtk2reference/ for more info.


pix_small = gtk.gdk.pixbuf_new_from_file("icon-small.png") pix_large = gtk.gdk.pixbuf_new_from_file("icon-small.png")

image = gtk.Image()
image.set_from_pixbuf(pix_small)

image.show()

button = gtk.Button()
button.add(image)
button.show()

def button_enter(bt, ev):
        bt.child.set_from_pixbuf(pix_large)
def button_enter(bt, ev):
        bt.child.set_from_pixbuf(pix_small)

button.connect("enter-notify-event", button_enter)
button.connect("leave-notify-event", button_leave)

That's it. I could have misspelled some function names, be warned. Good luck.





_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to