def __init__(self, parent, id): sc.SizedDialog.__init__(self, None, -1, "SizedForm Dialog with a scolled panel", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER, size=wx.Size(-1, 220)) cPane = self.GetContentsPane() pane = sc.SizedScrolledPanel(cPane, wx.ID_ANY) pane.SetSizerProps(expand=True, proportion=1) pane.SetSizerType("form") # row 1 wx.StaticText(pane, -1, "Name") textCtrl = wx.TextCtrl(pane, -1, "Your name here") textCtrl.SetSizerProps(expand=True) # row 2 wx.StaticText(pane, -1, "Email") emailCtrl = wx.TextCtrl(pane, -1, "") emailCtrl.SetSizerProps(expand=True) # row 3 wx.StaticText(pane, -1, "Gender") wx.Choice(pane, -1, choices=["male", "female"]) # row 4 wx.StaticText(pane, -1, "State") wx.TextCtrl(pane, -1, size=(60, -1)) # two chars for state # row 5 wx.StaticText(pane, -1, "Title") # here's how to add a 'nested sizer' using sized_controls radioPane = sc.SizedPanel(pane, -1) radioPane.SetSizerType("horizontal") radioPane.SetSizerProps(expand=True) # make these children of the radioPane to have them use # the horizontal layout wx.RadioButton(radioPane, -1, "Mr.") wx.RadioButton(radioPane, -1, "Mrs.") wx.RadioButton(radioPane, -1, "Dr.") # end row 5 # add dialog buttons self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))
def __init__(self, parent): FLAGS = (wx.CAPTION | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.CLOSE_BOX | wx.RESIZE_BORDER) sc.SizedDialog.__init__(self, None, -1, "Student Registration", style=FLAGS) cPane = self.GetContentsPane() pane = sc.SizedScrolledPanel(cPane, wx.ID_ANY) pane.SetSizerProps(expand=True, proportion=1) pane.SetSizerType("vertical") # ----------------------------------------------------------------------- ''' btnbmp = wx.Bitmap('images/user.png') self.imagebtn = wx.BitmapButton(pane, bitmap=btnbmp, size=(150,100), pos=wx.DefaultPosition, style=wx.BU_BOTTOM) self.imagebtn.SetSizerProps(border=(['all'],10)) self.imagebtn.SetLabel('Add Photo') self.imagebtn.Bind(wx.EVT_BUTTON, self.OnAddPhoto) ''' # line = wx.StaticLine(pane, size=(500, -1)) # line.SetSizerProps(expand=True) self.fn_lbl = wx.StaticText(pane, -1, "Firstname", wx.DefaultPosition, wx.DefaultSize) self.fname = wx.TextCtrl(pane, -1, " ", size=(150, -1)) self.ln_lbl = wx.StaticText(pane, -1, "Lastame", wx.DefaultPosition, wx.DefaultSize) self.lname = wx.TextCtrl(pane, -1, " ", size=(150, -1)) self.dob_lbl = wx.StaticText(pane, -1, "Date of Birth", wx.DefaultPosition, wx.DefaultSize) self.dob = adv.DatePickerCtrl(pane, size=(100, -1), style=wx.adv.DP_DROPDOWN | wx.adv.DP_SHOWCENTURY | wx.adv.DP_ALLOWNONE) self.sex_lbl = wx.StaticText(pane, -1, "Gender", wx.DefaultPosition, wx.DefaultSize) self.gender = wx.Choice(pane, -1, choices=["male", "female"]) self.addr_lbl = wx.StaticText(pane, -1, "Address", wx.DefaultPosition, wx.DefaultSize) self.address = wx.TextCtrl(pane, -1, " ", size=(150, -1)) self.num_lbl = wx.StaticText(pane, -1, "Phone", wx.DefaultPosition, wx.DefaultSize) self.phone = wx.TextCtrl(pane, -1, "", size=(150, -1)) self.eml_lbl = wx.StaticText(pane, -1, 'Email', wx.DefaultPosition, wx.DefaultSize) self.email = wx.TextCtrl(pane, -1, " ", size=(200, -1)) self.prt_lbl = wx.StaticText(pane, -1, 'Parent Name', wx.DefaultPosition, wx.DefaultSize) self.parent_name = wx.TextCtrl(pane, -1, size=(150, -1)) self.lvl_lbl = wx.StaticText(pane, -1, 'Level', wx.DefaultPosition, wx.DefaultSize) self.level = wx.Choice(pane, -1, choices=['JHS', 'SHS', 'Professional']) self.adm_lbl = wx.StaticText(pane, -1, 'Addmission Date', wx.DefaultPosition, wx.DefaultSize) self.adm_date = adv.DatePickerCtrl(pane, size=(200, -1), style=wx.adv.DP_DROPDOWN | wx.adv.DP_SHOWCENTURY | wx.adv.DP_ALLOWNONE) self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))
def test_panelCtor(self): p = sc.SizedScrolledPanel(self.frame)