Hey guys,
I’m working on learning some wxPython basics, and I’m running up against an issue that I haven’t been able to decipher. Here’s my code:
class PasswordPanel(wx.Dialog):
def init(self, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE):
self.sizer1 = wx.BoxSizer(wx.VERTICAL)
self.buttonSizer= wx.StdDialogButtonSizer()
self.dlg1 = wx.TextCtrl(self, -1, "Enter Username:", "", size=(80,-1))
self.dlg2 = wx.TextCtrl(self, -1, "Enter Password:", "", style=wx.TE_PASSWORD, size=(80,-1))
self.submit = wx.Button(self, "Submit", wx.ID_OK)
self.cancel = wx.Button(self, "Cancel", wx.ID_CANCEL)
self.sizer1.Add(self.dlg1, 0, wx.ALIGN_CENTER|wx.ALL, 5)
self.sizer1.Add(self.dlg2, 0, wx.ALIGN_CENTER|wx.ALL, 5)
self.buttonSizer.AddButton(self.submit)
self.buttonSizer.AddButton(self.cancel)
self.buttonSizer.Realize()
self.sizer1.Add(self.buttonSizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
self.SetSizer(self.sizer1)
self.sizer1.Fit(self)
self.ShowModal(True)
This is my output:
bt Ticketing_System # python main.py
Traceback (most recent call last):
File “main.py”, line 68, in InitializeConnection
self.passwordDialog = PasswordPanel(self, -1, “User Authentication”)
File “main.py”, line 75, in init
self.dlg1 = wx.TextCtrl(self, -1, “Enter Username:”, “”, size=(80,-1))
File “/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/_controls.py”, line 1691, in init
controls.TextCtrl_swiginit(self,controls.new_TextCtrl(*args, **kwargs))
TypeError: in method ‘new_TextCtrl’, expected argument 1 of type ‘wxWindow *’
This seems to be saying that it is not receiving parent window information? Or I am totally off? Any help on what I’m missing would be appreciated.
Jason