I’ve got two frames – mainWindow, which is the “primary” frame, and moreWindow, which is a child of mainWindow. I’d like to show moreWindow when a button in mainWindow is clicked. Here’s what I’m trying:
def showChild(nil):
moreWindow.Show()
class mainWindow(wx.Frame):
def __init__:
buttonMore.Bind(wx.EVT_BUTTON, showChild)
class moreWindow(wx.Frame):
TypeError: unbound method Show() must be called with moreWindow instance as first argument (got nothing instead)
I tried using moreWindow.Show(moreWindow), and that just gave a more cryptic error.
you need to call that method on an instance of
moreWindow, not classmoreWindowitself. That is, you need to create an instance ofmoreWindowsomewhere in your code:And then call
showon that instance:Also, check this answer, it’s exactly what you want to do:
https://stackoverflow.com/a/11201346/1157444