I need help with a program I am making it creates window but doesn't display buttons aor text controls
import wx
import MySQLdb
db = MySQLdb.connect(host="localhost", user="root", passwd="Hornets71", db="soul_society")
cursor = db.cursor()
class MainWin(wx.Frame):
def reg():
number = self.numtxtctrl.GetLineText()
name = self.nametxtctrl.GetLineText()
uid = self.uidtxtctrl.GetLineText()
cursor.execute("INSERT INTO member_list (number, name, uid) VALUES(%s, %s, %s)", (number, name, uid))
db.commit()
def __init__(self, *args, **kwds):
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.numtxtxctrl = wx.TextCtrl(self, -1, "Put User # Here")
self.nametxtctrl = wx.TextCtrl(self, -1, "Put User Name Here")
self.uidtxtctrl = wx.TextCtrl(self, -1, "Put User's Unique ID Here")
self.regbutton = wx.Button(self, -1, "Register")
self.canbutton = wx.Button(self, -1, "Cancel")
self.regbutton.Bind(wx.EVT_BUTTON, self.reg)
self.canbutton.Bind(wx.EVT_BUTTON, self.numtxtctrl.Clear)
self.canbutton.Bind(wx.EVT_BUTTON, self.nametxtctrl.Clear)
self.canbutton.Bind(wx.EVT_BUTTON, self.uidtxtctrl.Clear)
self.__set_properties()
self.__do_layout()
def __set_properties(self):
self.SetTitle("Soul Society Recruiter Registration")
def __do_layout(self):
sizer = wx.FlexGridSizer(3, 3, 0, 0)
sizer.Add(self.numtxtctrl, 0, wx.ADJUST_MINSIZE, 0)
sizer.Add(self.nametxtctrl, 0, wx.ADJUST_MINSIZE, 0)
sizer.Add(self.uidtxtctrl, 0, wx.ADJUST_MINSIZE, 0)
sizer.Add(self.regbutton, 0, wx.ADJUST_MINSIZE, 0)
sizer.Add(self.canbutton, 0, wx.ADJUST_MINSIZE, 0)
self.SetAutoLayout(TRUE)
self.SetSizer(sizer)
sizer.Fit(self)
sizer.SetSizeHints(self)
self.Layout()
if __name__ == "__main__":
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
MainWin = MainWin(None, -1, "")
app.SetTopWindow(MainWin)
MainWin.Show()
app.MainLoop()