Advertisement
codemonkey

Simple wxPython AUI frame that crashes.

Oct 11th, 2012
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.98 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # Encoding: UTF-8
  3. """This script launches a GUI for testing regular expressions."""
  4.  
  5. import sys
  6. import os
  7. import re
  8.  
  9. try:
  10.     import wx
  11. except ImportError:
  12.     print "This script requires wxPython."
  13.     sys.exit(1)
  14.  
  15. class RegexTesterFrame(wx.Frame):
  16.     def __init__(self):
  17.         wx.Frame.__init__(
  18.             self, None, -1, 'Regex tester', (100, 100),
  19.             (400, 400), wx.DEFAULT_FRAME_STYLE
  20.         )
  21.         # wx.Frame.__init__(
  22.         #     self, None, -1, 'Regex tester', wx.DefaultPosition,
  23.         #     wx.DefaultSize, wx.DEFAULT_FRAME_STYLE
  24.         # )
  25.  
  26.         self.initialize_components()
  27.         self.CreateStatusBar()
  28.  
  29.     def initialize_components(self):
  30.         self._mgr = wx.aui.AuiManager()
  31.         self._mgr.SetManagedWindow(self)
  32.  
  33.         self._perspectives = []
  34.  
  35.         self._mgr.AddPane(
  36.             wx.CheckBox(self, -1, 'test'),
  37.             wx.aui.AuiPaneInfo().Name('Test pane').Caption('Test caption').Top()
  38.         )
  39.  
  40.         self._mgr.Update()
  41.  
  42.         self.Bind(wx.EVT_CLOSE, self.on_close)
  43.  
  44.         # self.create_flags_panel()
  45.  
  46.     def on_close(self, event):
  47.         self._mgr.UnInit()
  48.         del self._mgr
  49.         self.Destroy()
  50.  
  51.     # def create_flags_panel(self):
  52.     #     panel = wx.Panel(self, -1, style=wx.FULL_REPAINT_ON_RESIZE)
  53.  
  54.     #     sizer = wx.GridBagSizer(0, 5)
  55.     #     sizer.Add(wx.CheckBox(panel, -1, 'Global'), (0, 0))
  56.     #     sizer.Add(wx.CheckBox(panel, -1, 'Ignore case'), (0, 1))
  57.     #     sizer.Add(wx.CheckBox(panel, -1, 'Ignore whitespace'), (0, 2))
  58.     #     sizer.Add(wx.CheckBox(panel, -1, 'Multiline'), (0, 3))
  59.  
  60.     #     panel.SetSizerAndFit(sizer)
  61.  
  62.     #     return panel
  63.  
  64. class RegexTesterApp(wx.App):
  65.     def OnInit(self):
  66.         mainframe = RegexTesterFrame()
  67.         mainframe.Show()
  68.  
  69.         self.SetTopWindow(mainframe)
  70.         return True
  71.  
  72. def main():
  73.     app = RegexTesterApp(True)
  74.     app.MainLoop()
  75.  
  76. if __name__ == '__main__':
  77.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement