Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # -*- coding: utf-8 -*-
- import wx
- class Example(wx.Frame):
- def __init__(self, parent, title):
- super(Example, self).__init__(parent, title=title,
- size=(450, 350))
- self.InitUI()
- self.Centre()
- self.Show()
- def InitUI(self):
- panel = wx.Panel(self)
- sizer = wx.GridBagSizer(5, 5)
- # draws the line around all the elements seeing
- # as it is the main parent
- sb = wx.StaticBox(panel, label="Generation")
- # MAIN PARENT SIZER VERTICAL
- sbs = wx.StaticBoxSizer(sb, wx.VERTICAL)
- # CHILD SIZER ONE HORIZONTAL
- bs1 = wx.BoxSizer(wx.HORIZONTAL)
- bs1.Add(wx.StaticText(panel,-1,"New Text Filename:"), 0, wx.ALL, 8)
- bs1.Add(wx.TextCtrl(panel,-1), 0, wx.TOP, 5)
- # CHILD SIZER TWO HORIZONTAL
- bs2 = wx.BoxSizer(wx.HORIZONTAL)
- bs2.Add(wx.StaticText(panel,-1,"Text:"), 0, wx.ALL^wx.TOP, 8)
- # CHILD SIZER THREE HORIZONTAL
- bs3 = wx.BoxSizer(wx.HORIZONTAL)
- bs3.Add(wx.TextCtrl(panel,-1,size=(390,150),style = wx.TE_MULTILINE|wx.TE_PROCESS_TAB), 0, wx.ALL^wx.TOP, 8)
- # ADD ALL CHILD SIZERS TO ITS PARENT
- sbs.Add(bs1, flag=wx.BOTTOM, border=20)
- sbs.Add(bs2)
- sbs.Add(bs3)
- # Create Generate button
- bs4 = wx.BoxSizer(wx.HORIZONTAL)
- bs4.Add(wx.Button(panel, -1, label="Generate",style=wx.ALIGN_LEFT),1)
- # ADD PARENT SIZER TO GRANDFATHER SIZER
- sizer.Add(sbs, pos=(0, 0), span=(1, 5), flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT , border=10)
- sizer.Add(bs4, pos=(1, 0), span=(1, 5), flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT , border=10)
- sizer.AddGrowableCol(2)
- panel.SetSizer(sizer)
- if __name__ == '__main__':
- app = wx.App()
- Example(None, title="nPy | Teknologika")
- app.MainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement