所以我正在编写一个程序,我需要从主 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))