Reputation: 16275
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.
Upvotes: 0
Views: 278
Reputation: 17312
you need to call that method on an instance of moreWindow
, not class moreWindow
itself. That is, you need to create an instance of moreWindow
somewhere in your code:
more_window = moreWindow()
And then call show
on that instance:
more_window.show()
Also, check this answer, it's exactly what you want to do:
https://stackoverflow.com/a/11201346/1157444
Upvotes: 1