正如你在这个例子中看到的那样,如果我们关闭然后再次显示包含 gtk.Label 的窗口 - 标签也会显示,但如果窗口包含 gtk.Image - 我们看不到它。
import gtk,gobject
def dest(*a):
print 1
gobject.timeout_add(1000,dest2)
#also, why it is impossible to show window again at once it closed?
def dest2(*a):
print 2
win.add(child)
win.show_all()
shild.queue_draw()
print 'where is is?'
win = gtk.Window()
win.connect('delete-event', dest)
l = gtk.Label('gtk')
image=gtk.Image()
f=fopen('some_image.png','r')
loader = gtk.PixbufLoader()
loader.write(f.read())
loader.close()
f.close()
image.set_from_pixbuf(loader.get_pixbuf())
child=image
#child=l #so, if uncomment this string - everything is perfect
win.add(child)
win.show_all()
gtk.main()