Dies funktioniert nicht gut:Wie benutze ich das gleiche Widget zweimal in pygtk?
image_log = gtk.Image()
image_log.set_from_file("test.png")
self.out_button = gtk.Button()
self.out_button.add(image_log)
self.err_button = gtk.Button()
self.err_button.add(image_log)
another_box.pack_start(self.out_button, False)
another_box.pack_start(self.err_button, False)
Das Problem ist, image_log verwendet wird zweimal und GTK es nicht mag. Gibt es eine .copy() -Methode? Oder sollte ich einfach Plain Vanilla Deepcopy verwenden?
EDIT: Sieht so aus, als ob es keine Standardmethode zum Klonen von Objekten in GTK gibt. Factory wird in diesem Fall den Trick machen.
GTK Warnung:
app/gui.py:248: GtkWarning: gtk_box_pack: assertion `child->parent == NULL' failed
hbox_errlog.pack_start(image_log)
Was ist Ihre GTK/PyGTK Fehlerausgabe? –