I'm new to Gnome development.
I am trying do create a button which, when pressed, will copy the content of its label to the clipboard and closes the app.
This is my code, where "self" is a class that extends Gtk.Window.
If I don't close the app, it works just fine.
Thank you
def copy_and_quit(self, button: Gtk.Button):
clip = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
clip.set_text(button.get_label(), -1)
self.close()
Edit: I am a noob in Gtk development. I re-factorized my app to be a Gtk.Application with a Gtk.Window, following this example.
Now I do
def copy_and_quit(self, button: Gtk.Button):
clip = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
clip.set_text(button.get_label(), -1)
Gtk.main_quit()
Which works.
Bye