This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Python Program

By: a guest on Dec 18th, 2012  |  syntax: Python  |  size: 1.96 KB  |  views: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3.  
  4.  
  5. import wx
  6.  
  7. class Example(wx.Frame):
  8.  
  9.     def __init__(self, parent, title):    
  10.         super(Example, self).__init__(parent, title=title,
  11.             size=(450, 350))
  12.  
  13.         self.InitUI()
  14.         self.Centre()
  15.         self.Show()    
  16.  
  17.     def InitUI(self):
  18.      
  19.         panel = wx.Panel(self)
  20.        
  21.         sizer = wx.GridBagSizer(5, 5)
  22.  
  23.         #  draws the line around all the elements seeing
  24.         #  as it is the main parent
  25.         sb = wx.StaticBox(panel, label="Generation")
  26.  
  27.         # MAIN PARENT SIZER VERTICAL
  28.         sbs = wx.StaticBoxSizer(sb, wx.VERTICAL)
  29.  
  30.         # CHILD SIZER ONE HORIZONTAL
  31.         bs1 = wx.BoxSizer(wx.HORIZONTAL)
  32.         bs1.Add(wx.StaticText(panel,-1,"New Text Filename:"), 0, wx.ALL, 8)
  33.         bs1.Add(wx.TextCtrl(panel,-1), 0, wx.TOP, 5)
  34.  
  35.         # CHILD SIZER TWO HORIZONTAL
  36.         bs2 = wx.BoxSizer(wx.HORIZONTAL)
  37.         bs2.Add(wx.StaticText(panel,-1,"Text:"), 0, wx.ALL^wx.TOP, 8)
  38.  
  39.         # CHILD SIZER THREE HORIZONTAL
  40.         bs3 = wx.BoxSizer(wx.HORIZONTAL)
  41.         bs3.Add(wx.TextCtrl(panel,-1,size=(390,150),style = wx.TE_MULTILINE|wx.TE_PROCESS_TAB), 0, wx.ALL^wx.TOP, 8)
  42.  
  43.         # ADD ALL CHILD SIZERS TO ITS PARENT
  44.         sbs.Add(bs1, flag=wx.BOTTOM, border=20)
  45.         sbs.Add(bs2)
  46.         sbs.Add(bs3)
  47.  
  48.         # Create Generate button
  49.         bs4 = wx.BoxSizer(wx.HORIZONTAL)
  50.         bs4.Add(wx.Button(panel, -1, label="Generate",style=wx.ALIGN_LEFT),1)
  51.  
  52.  
  53.        
  54.        
  55.        
  56.  
  57.         # ADD PARENT SIZER TO GRANDFATHER SIZER
  58.         sizer.Add(sbs, pos=(0, 0), span=(1, 5), flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT , border=10)
  59.         sizer.Add(bs4, pos=(1, 0), span=(1, 5), flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT , border=10)
  60.  
  61.         sizer.AddGrowableCol(2)
  62.        
  63.         panel.SetSizer(sizer)
  64.  
  65.  
  66. if __name__ == '__main__':
  67.  
  68.     app = wx.App()
  69.     Example(None, title="nPy | Teknologika")
  70.     app.MainLoop()
clone this paste RAW Paste Data