I built an application using Glade, Python3, Gtk3. When I open a dialog window and close it again, I receive the error:
TypeError: on_aboutdialog_destroy() takes 1 positional argument but 2 were given
My application looks like this:
#!/usr/bin/env python
from gi.repository import Gtk
from gi.repository import Gio
import sys
class Handler:
#Main Window
def on_mainwindow_destroy(self):
print("destroy window")
Gtk.main_quit()
#Menu items
def on_menuquit_activate(self, menuitem):
print("quit from menu")
Gtk.main_quit()
def on_menuabout_activate(self, menuitem, data=None):
print("menu about activated")
aboutdialog = builder.get_object("aboutdialog")
aboutdialog.run()
def on_aboutdialog_destroy(self):
print("destroy about")
aboutdialog.hide()
builder = Gtk.Builder()
builder.add_from_file("psn.glade")
builder.connect_signals(Handler())
window = builder.get_object("mainwindow")
window.show_all()
Gtk.main()
I got some help at the official GTK-Forum. Closing works by doing this:
self.ab = self.builder.get_object("aboutdialog")
def on_aboutdialog_destroy(self, widget):
self.ab.hide()