Hello,
I'm writing a program using wxPython. I've got this code:

class captchaFrame(wx.Dialog):
	def __init__(self, parent, title, id):
		wx.Dialog.__init__(self, parent, id, title, size = (390,350))

		self.panel = wx.Panel(self)
		self.vbox1 = wx.Sizer(wx.VERTICAL)
		self.hbox1 = wx.Sizer(wx.HORIZONTAL)
		self.hbox2 = wx.Sizer(wx.HORIZONTAL)
		self.hbox3 = wx.Sizer(wx.HORIZONTAL)
		self.hbox4 = wx.Sizer(wx.HORIZONTAL)

		self.yt_username = wx.StaticText(self.panel, label = 'YouTube Username/Email:')
		self.hbox1.Add(self.yt_username, flag = wx.EXPAND | wx.RIGHT, border = 8)
		self.yt_usrnmeTXT = wx.TextCtrl(self.panel)
		self.hbox1.Add(self.yt_usrnmeTXT, flag = wx.EXPAND, proportion = 1)
		self.yt_password = wx.StaticText(self.panel, label = 'Password:')
		self.hbox1.Add(self.yt_password, flag = wx.EXPAND | wx.ALL, border = 8)
		self.yt_passwordTXT = wx.TextCtrl(self.panel)
		self.hbox1.Add(self.yt_passwordTXT, flag = wx.EXPAND, proportion = 1)
		self.vbox.Add(self.hbox1, flag = wx.EXPAND | wx.LEFT | wx.RIGHT| wx.TOP, border = 10)

		pic = urllib2.urlopen(self.yt_service._GetCaptchaURL()).read()
		if os.path.exists(os.environ['APPDATA'] + '\\' + 'cap') == False:
			os.mkdir(os.environ['APPDATA'] + '\\' + 'cap')
		cPic = open(os.environ['APPDATA'] + '\\' + 'cap' + '\\' + 'pic.gif', 'wb').write(pic)
		self.captcha_image = wx.Bitmap(os.environ['APPDATA'] + '\\' + 'cap' + '\\' + 'pic.gif')
		self.captcha_image = wx.StaticBitmap(self.panelFront, -1, self.captcha_image)
		self.hbox2.Add(self.captcha_image, flag = wx.ALIGN_CENTRE, proportion = 1)
		self.vbox.Add(self.hbox2, flag = wx.ALIGN_CENTRE, proportion = 1)

		self.captcha_text = wx.StaticText(self.panel, label = 'Enter Code:')
		self.hbox3.Add(self.captcha_text, flag = wx.EXPAND | wx.RIGHT, border = 8)
		self.captcha_txtCTRL = wx.TextCtrl(self.panel)
		self.hbox3.Add(self.captcha_txtCTRL, flag = wx.EXPAND, proportion = 1)
		self.vbox.Add(self.hbox3, flag = wx.EXPAND, border = 8)

		self.validButt = wx.Button(self.panel, label = 'Login', size = (100,30))
		self.hbox2.Add(self.validButt, flag = wx.ALIGN_RIGHT, proportion = 1)
		self.vbox.Add(self.hbox2, flag = wx.ALIGN_RIGHT | wx.LEFT | wx.RIGHT | wx.TOP, border = 10)

		self.panel.SetSizer(self.vbox)
		wx.Bind(wx.EVT_BUTTON, self.loginCaptcha, self.validButt)

	def loginCaptcha(self, event):
		if self.yt_usrnmeTXT.GetValue() == '' or self.yt_passwordTXT.GetValue() == '' or self.captcha_txtCTRL.GetValue() == '':
			error102 = wx.MessageDialog(None, 'Error 102: No User Info Set', 'Error', wx.OK | wx.ICON_ERROR)
			error102.ShowModal()
		else:
			TTTT.verifyUsr(captcha_t = TTTT.yt_service._GetCaptchaToken, captcha_r = self.captcha_txtCTRL.GetValue())

But the problem is I keep getting the error:

Traceback (most recent call last):
File "C:\Users\me\Desktop\prog.py", line 14, in __init__
self.vbox1 = wx.Sizer(wx.VERTICAL) 
TypeError: __init__() takes exactly 1 argument (2 given)

I don't know how to fix this because the way I set up the sizer before in another class (not written here because it does not have errors) was alright. Please help.

some of the indentations are off from when i C&P'd it from SublimeText on my desktop

self.vbox1 = wx.Sizer(wx.VERTICAL)

self.hbox1 = wx.Sizer(wx.HORIZONTAL)

You possibly want

self.hbox1 = wx.BoxSizer()
self.hbox1.Add(self.yt_username, flag = wx.EXPAND | wx.RIGHT, border = 8)

self.vbox1 = wx.Sizer(wx.VERTICAL) 
# and the above becomes
self.vbox1 = wx.BoxSizer(wx.VERTICAL)

See this example in the "Starting wxPython (GUI code)" thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.