Hi, everyone.
How can I to change the alpha of an image? The code sample is as follows.
import pygtk
pygtk.require('2.0')
import gtk
class ImagesExample:
# when invoked (via signal delete_event), terminates the application.
def close_application(self, widget, event, data=None):
gtk.main_quit()
return False
def __init__(self):
# create the main window, and attach delete_event signal to terminating
# the application
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.connect("delete_event", self.close_application)
window.set_border_width(10)
window.show()
# a horizontal box to hold the buttons
hbox = gtk.HBox()
hbox.show()
window.add(hbox)
pixbuf = gtk.gdk.pixbuf_new_from_file("Button-Last-72x72.png")
print pixbuf.get_n_channels()
print pixbuf.get_has_alpha()
image = gtk.Image()
image.set_from_pixbuf(pixbuf)
image.show()
print image.get_window()
hbox.pack_start(image)
def main():
gtk.main()
return 0
if __name__ == "__main__":
ImagesExample()
main()
_______________________________________________
pygtk mailing list pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/