python - Passing variables between two WxPython windows -
so im writing program , need list main gui window pop window action selected options main window
the problem cant pass variable when call class new window
when create instance want pass list
act = action(none, "action") but lets me pass name of window , if try create new parameter error:
traceback (most recent call last): file "c:\documents , settings\user\desktop\invent manager.py", line 274, in auction act = action(none, "action", "item") file "c:\documents , settings\user\desktop\invent manager.py", line 352, in __init__ self.initui() file "c:\documents , settings\user\desktop\invent manager.py", line 357, in initui main = gui() typeerror: __init__() takes 4 arguments (1 given) here init of pop window:
def __init__(self, parent, title, item_id): super(action, self).__init__(parent, title=title, size=(200, 200)) self.initui() self.centre() self.show() someone please tell me how can this!
here main gui's __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))
try following code. replaced __init__ signature make arguments optional except parent, title:
def __init__(self, parent, title, *args, **kwargs): super(action, self).__init__(parent, title=title, size=(200, 200)) self.initui() self.centre() self.show()
Comments
Post a Comment