1
in meinem Programm würde Ich mag ein Bild ändern, indem Sie auf eine Schaltfläche, aber ich kann die FunktionWie kann ich das Bild eines GtkImage ändern?
class TestGdkPixbuf(Gtk.Window):
Cover= "image.png"
Cover2= "image2.png"
def __init__(self):
Gtk.Window.__init__(self, title="TestGdkPixbuf")
mainLayout = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
self.image = GdkPixbuf.Pixbuf.new_from_file_at_size(self.Cover, 250, 250)
image_renderer = Gtk.Image.new_from_pixbuf(self.image)
button = Gtk.Button(label='Change')
button.connect('clicked', self.editPixbuf)
mainLayout.pack_start(image_renderer, True, True, 0)
mainLayout.pack_start(button, True, True, 0)
self.add(mainLayout)
def editPixbuf(self, button):
self.image = GdkPixbuf.Pixbuf.new_from_file_at_size(self.Cover2, 250, 250)
print(self.Cover2)
Vielen Dank für Ihre Hilfe nicht finden