プログラムを書いているので、メイン GUI ウィンドウから、メイン ウィンドウから選択したオプションでアクションを実行するポップアップ ウィンドウまでのリストを取得する必要があります。
問題は、新しいウィンドウのクラスを呼び出すときに変数を渡すことができないことです
インスタンスを作成するときに、リストを渡したい
act = Action(None, "Action")
ただし、ウィンドウの名前のみを渡すことができ、新しいパラメーターを作成しようとすると、次のエラーが発生します。
Traceback (most recent call last):
File "C:\Documents and Settings\User\Desktop\Invent Manager.py", line 274, in auction
act = Action(None, "Action", "item")
File "C:\Documents and Settings\User\Desktop\Invent Manager.py", line 352, in __init__
self.InitUI()
File "C:\Documents and Settings\User\Desktop\Invent Manager.py", line 357, in InitUI
main = GUI()
TypeError: __init__() takes exactly 4 arguments (1 given)
これが私のポップアップウィンドウの初期化です:
def __init__(self, parent, title, item_id):
super(Action, self).__init__(parent, title=title,
size=(200, 200))
self.InitUI()
self.Centre()
self.Show()
誰か私がこれを行う方法を教えてください!
メインの GUI は次の__init__
とおりです。
class GUI(wx.Frame):
#GUI
def __init__(self, parent, id, title):
self.inv = GetInvent()
self.inv.Login()
self.packages = self.inv.getinv()
self.packages2 = self.inv.getSDB()
self.id_list = self.inv.id_list
self.show = 1
wx.Frame.__init__(self, parent, id, title, size=(450, 400))