I did see this piece of code in a book and provoked my few questions on inheritance,
txt.py
class LoginPanel(wx.Panel):
def __init__(self,parent)
super(LoginPanel,self).__init__(parent)
self._username = wx.TextCtrl(self)
self._password = wx.TextCtrl(self,style=wx.TE_PASSWORD)
sizer = wx.FlexGridSizer(2,2,8,8)
sizer.Add(wx.StaticText(self,label="Username:"),
0,wx.ALIGN_CENTER_VERTICAL)
sizer.Add(self._username,0,wx.EXPAND)
sizer.Add(wx.StaticText(self,label="Password"),
0,wx.ALIGN_CENTER_VERTICAL)
sizer.Add(self._password,0,wx.EXPAND)
msizer = wx.BoxSizer(wx.VERTICAL)
msizer.Add(sizer,1,wx.EXPAND|wx.ALL,20)
btnszr = wx.StdDialogButtonSizer()
button = wx.Button(self, wx.ID_OK)
button.SetDefault()
btnszr.AddButton(button)
msizer.Add(btnszr,0,wx.ALIGN_CENTER|wx.ALL,12)
btnszr.Realize()
self.SetSizer(msizer)
How can we use the SetSizer method thats part of the Window object directly? Is that how do we use the parent methods without any reference?
super(). For that code it's better to callwx.Panel.__init__()directly.