Are you using Gtk.main()? If not, you can’t use Gtk.main_quit(). For example, you may (and should) be using GtkApplication instead.
Side note: gtk_dialog_run() uses a recursive main loop. This API is no longer recommended, and has been removed in GTK4. Instead, you can connect to the response signal and (optionally) make the dialog modal. That also works in GTK3.
Are you using Gtk.main()? If not, you can’t use Gtk.main_quit(). For example, you may (and should) be using GtkApplication instead.
I use Gtk.main() and Gtk.main_quit() works fine in other places of the script.
Side note: gtk_dialog_run() uses a recursive main loop. This API is no longer recommended, and has been removed in GTK4. Instead, you can connect to the response signal and (optionally) make the dialog modal. That also works in GTK3.
Sorry, I’m afraid coding is hard for me. Not sure if this demo is what you meant.
button.connect("clicked", self.on_clicked_button) would be the way to go, but I have no idea how to name the button in the previous dialog sample (I mean, I don’t know its variable name).
My case is the opposite as the one from the example. I need to connect from a button in a dialog, not to it (if I’m not getting this wrong ).
BTW, OK buttons are discouraged by the GNOME HIG. It’s better to use a verb, e.g. ‘Close’. Also, for a dialog with only one button, closing the dialog via the Esc key (or the X, if present) should have the same result as clicking that button.