2012-10-27 21 views
0

我有兩個框架 - mainWindow,它是「主」框架,moreWindow,它是mainWindow的子項。我想在單擊mainWindow中的按鈕時顯示更多的窗口。這裏就是我想:顯示子wx.Frame?

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) 

我試着用moreWindow.Show(moreWindow),而只是給了一個更神祕的錯誤。

+0

是什麼,當你嘗試,你得到了錯誤? – iabdalkader

+0

@mux'TypeError:未綁定方法Show()必須用moreWindow實例作爲第一個參數調用(取而代之的是類型實例)' – tkbx

+0

對不起,請檢查我的答案。 – iabdalkader

回答

1

您需要調用實例moreWindow,而不是moreWindow本身。也就是說,你需要在你的代碼的某個地方創造的moreWindow一個實例:

more_window = moreWindow() 

,然後在該實例調用show

more_window.show() 

此外,還要檢查這個答案,這是你想要什麼這樣做:

https://stackoverflow.com/a/11201346/1157444