daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Jun 19th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2.  
  3. import wx
  4.  
  5. class MyApp (wx.Frame):
  6.     def __init__(self, parent, id, title):
  7.         wx.Frame.__init__(self, parent, id, title, size=(390, 350))
  8.     menubar = wx.MenuBar()
  9.     help = wx.Menu()
  10.     help.Append(ID_ABOUT, '&About')
  11.     self.Bind(wx.EVT_MENU, self.OnAboutBox, id=wx.ID_ABOUT)
  12.     menubar.Append(help, '&Help')
  13.     self.SetMenuBar(menubar)
  14.  
  15.     self.Centre()
  16.     self.Show(True)
  17.  
  18.     panel = wx.Panel(self, -1)
  19.  
  20.     font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT)
  21.     font.SetPointSize(9)
  22.  
  23.     vbox = wx.BoxSizer(wx.VERTICAL)
  24.  
  25.     hbox1 = wx.BoxSizer(wx.HORIZONTAL)
  26.     st1 = wx.StaticText(panel, -1, 'Class Name')
  27.     st1.SetFont(font)
  28.     hbox1.Add(st1, 0, wx.RIGHT, 8)
  29.     tc = wx.TextCtrl(panel, -1)
  30.     hbox1.Add(tc, 1)
  31.     vbox.Add(hbox1, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 10)
  32.  
  33.     vbox.Add((-1, 10))
  34.  
  35.     hbox2 = wx.BoxSizer(wx.HORIZONTAL)
  36.     st2 = wx.StaticText(panel, -1, 'Matching Classes')
  37.     st2.SetFont(font)
  38.     hbox2.Add(st2, 0)
  39.     vbox.Add(hbox2, 0, wx.LEFT | wx.TOP, 10)
  40.  
  41.     vbox.Add((-1, 10))
  42.  
  43.     hbox3 = wx.BoxSizer(wx.HORIZONTAL)
  44.     tc2 = wx.TextCtrl(panel, -1, style=wx.TE_MULTILINE)
  45.     hbox3.Add(tc2, 1, wx.EXPAND)
  46.     vbox.Add(hbox3, 1, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
  47.  
  48.     vbox.Add((-1, 25))
  49.  
  50.     hbox4 = wx.BoxSizer(wx.HORIZONTAL)
  51.     cb1 = wx.CheckBox(panel, -1, 'Case Sensitive')
  52.     cb1.SetFont(font)
  53.     hbox4.Add(cb1)
  54.     cb2 = wx.CheckBox(panel, -1, 'Nested Classes')
  55.     cb2.SetFont(font)
  56.     hbox4.Add(cb2, 0, wx.LEFT, 10)
  57.     cb3 = wx.CheckBox(panel, -1, 'Non-Project classes')
  58.     cb3.SetFont(font)
  59.     hbox4.Add(cb3, 0, wx.LEFT, 10)
  60.     vbox.Add(hbox4, 0, wx.LEFT, 10)
  61.  
  62.     vbox.Add((-1, 25))
  63.  
  64.     hbox5 = wx.BoxSizer(wx.HORIZONTAL)
  65.     btn1 = wx.Button(panel, -1, 'Ok', size=(70, 30))
  66.     hbox5.Add(btn1, 0)
  67.     btn2 = wx.Button(panel, -1, 'Close', size=(70, 30))
  68.     hbox5.Add(btn2, 0, wx.LEFT | wx.BOTTOM , 5)
  69.     vbox.Add(hbox5, 0, wx.ALIGN_RIGHT | wx.RIGHT, 10)
  70.  
  71.     panel.SetSizer(vbox)
  72.     self.Centre()
  73.     self.Show(True)
  74.  
  75.     def OnAboutBox(self, event):
  76.         description = """ describe my app here """
  77.  
  78.         licence = """ blablabla """
  79.  
  80.  
  81.         info = wx.AboutDialogInfo()
  82.  
  83.         info.SetIcon(wx.Icon('icons/icon.png', wx.BITMAP_TYPE_PNG))
  84.         info.SetName('')
  85.         info.SetVersion('1.0')
  86.         info.SetDescription(description)
  87.         info.SetCopyright('')
  88.         info.SetWebSite('')
  89.         info.SetLicence(licence)
  90.         info.AddDeveloper('')
  91.         info.AddDocWriter('')
  92.         info.AddArtist('')
  93.         info.AddTranslator('')
  94.  
  95.         wx.AboutBox(info)
  96.  
  97. app = wx.App()
  98. MyApp (None, -1, 'Go To Class')
  99. app.MainLoop()
  100.    
  101. app = wx.App(redirect=True)
  102. app = wx.App(redirect=True,filename="mylogfile.txt")
  103.    
  104. import wx
  105. import sys
  106. import traceback
  107.  
  108. def show_error():
  109.     message = ''.join(traceback.format_exception(*sys.exc_info()))
  110.     dialog = wx.MessageDialog(None, message, 'Error!', wx.OK|wx.ICON_ERROR)
  111.     dialog.ShowModal()
  112.  
  113. class Frame(wx.Frame):
  114.     def __init__(self):
  115.         super(Frame, self).__init__(None, -1, 'My Frame')
  116.     def cause_error(self):
  117.         raise Exception, 'This is a test.'
  118.  
  119. def main():
  120.     app = wx.PySimpleApp()
  121.     try:
  122.         frame = Frame()
  123.         frame.Show()
  124.         frame.cause_error()
  125.         app.MainLoop()
  126.     except:
  127.         show_error()
  128.  
  129. if __name__ == '__main__':
  130.     main()
  131.    
  132. f=open('app.log','w')
  133. import sys
  134. sys.stdout=f
  135. sys.stderr=f
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top