mirror of
https://github.com/freedoom/freedoom.git
synced 2025-09-02 07:25:45 -04:00
each loop creates a new and packs it into the hbox
This commit is contained in:
parent
ede6852539
commit
d3a922a2bd
1 changed files with 18 additions and 21 deletions
|
@ -12,10 +12,6 @@ class ImagesExample:
|
|||
gtk.main_quit()
|
||||
return False
|
||||
|
||||
# is invoked when the button is clicked. It just prints a message.
|
||||
def button_clicked(self, widget, data=None):
|
||||
print "button %s clicked" % data
|
||||
|
||||
def __init__(self):
|
||||
# create the main window, and attach delete_event signal to terminating
|
||||
# the application
|
||||
|
@ -31,30 +27,32 @@ class ImagesExample:
|
|||
|
||||
# create several images with data from files and load images into
|
||||
# buttons
|
||||
image = gtk.Image()
|
||||
image.set_from_file("../../patches/wall40_1.gif")
|
||||
pixbuf = image.get_pixbuf()
|
||||
baseimage = gtk.Image()
|
||||
baseimage.set_from_file("../../patches/wall40_1.gif")
|
||||
pixbuf = baseimage.get_pixbuf()
|
||||
if pixbuf:
|
||||
scale = 2
|
||||
image.set_from_pixbuf(pixbuf.scale_simple(
|
||||
baseimage.set_from_pixbuf(pixbuf.scale_simple(
|
||||
pixbuf.get_width() * scale,
|
||||
pixbuf.get_height() * scale,
|
||||
gtk.gdk.INTERP_NEAREST
|
||||
))
|
||||
image.show()
|
||||
baseimage.show()
|
||||
|
||||
|
||||
image2 = gtk.Image()
|
||||
image2.set_from_file("../../patches/wall42_3.gif")
|
||||
pb = image2.get_pixbuf()
|
||||
image2.set_from_pixbuf(pb.scale_simple(
|
||||
basepatch = gtk.Image()
|
||||
basepatch.set_from_file("../../patches/wall42_3.gif")
|
||||
pb = basepatch.get_pixbuf()
|
||||
basepatch.set_from_pixbuf(pb.scale_simple(
|
||||
pb.get_width() * scale,
|
||||
pb.get_height() * scale,
|
||||
gtk.gdk.INTERP_NEAREST
|
||||
))
|
||||
pb = image2.get_pixbuf()
|
||||
pb = basepatch.get_pixbuf()
|
||||
|
||||
for (x,y) in [(0,0), (51,0), (104,0)]:
|
||||
image = gtk.Image()
|
||||
image.set_from_pixbuf(baseimage.get_pixbuf().copy())
|
||||
image.show()
|
||||
pb.composite(
|
||||
image.get_pixbuf(),
|
||||
x * scale, y * scale,
|
||||
|
@ -69,7 +67,6 @@ class ImagesExample:
|
|||
button.add(image)
|
||||
button.show()
|
||||
hbox.pack_start(button)
|
||||
button.connect("clicked", self.button_clicked, "2")
|
||||
|
||||
def main():
|
||||
gtk.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue