Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import wx
- class MyForm(wx.Frame):
- def __init__(self):
- wx.Frame.__init__(self, None, wx.ID_ANY, "Tutorial")
- # Add a panel so it looks the correct on all platforms
- panel = wx.Panel(self, wx.ID_ANY)
- # create the labels
- lblOne = wx.StaticText(panel, label="labelOne", size=(60,-1))
- lblTwo = wx.StaticText(panel, label="lblTwo", size=(60,-1))
- lblThree = wx.StaticText(panel, label="lblThree", size=(60,-1))
- # create the text controls
- txtOne = wx.TextCtrl(panel)
- txtTwo = wx.TextCtrl(panel)
- txtThree = wx.TextCtrl(panel)
- buttonFour = wx.Button(panel)
- # create some sizers
- mainSizer = wx.BoxSizer(wx.VERTICAL)
- lineOneSizer = wx.BoxSizer(wx.HORIZONTAL)
- lineTwoSizer = wx.BoxSizer(wx.HORIZONTAL)
- lineThreeSizer = wx.BoxSizer(wx.HORIZONTAL)
- # add widgets to sizers
- lineOneSizer.Add(lblOne, 0, wx.ALL|wx.ALIGN_LEFT, 5)
- lineOneSizer.Add(txtOne, 1, wx.ALL, 5)
- lineTwoSizer.Add(lblTwo, 0, wx.ALL|wx.ALIGN_LEFT, 5)
- lineTwoSizer.Add(txtTwo, 0, wx.ALL, 5)
- lineThreeSizer.Add(lblThree, 0, wx.ALL|wx.ALIGN_LEFT, 5)
- lineThreeSizer.Add(txtThree, 0, wx.ALL, 5)
- lineThreeSizer.Add(buttonFour, 0, wx.ALL, 5)
- mainSizer.Add(lineOneSizer)
- mainSizer.Add(lineTwoSizer)
- mainSizer.Add(lineThreeSizer)
- panel.SetSizer(mainSizer)
- # Run the program
- if __name__ == "__main__":
- app = wx.App(False)
- frame = MyForm()
- frame.Show()
- app.MainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement