Advertisement
nucular

NOLCtest 1.0

Mar 5th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.66 KB | None | 0 0
  1. #!/usr/bin/env python
  2. """NOLCtest 1.0
  3. by nucular
  4.  
  5. A little wxPython example for the NOLC module.
  6. This is my first wx GUI application in Python, so...
  7.  
  8. Have fun.
  9.  
  10. This code is published under the Public Domain!
  11. """
  12.  
  13. import wx, sys
  14.  
  15. __version__ = "1.0"
  16.  
  17. app = wx.PySimpleApp(True,None,True,True)
  18. frame = wx.Frame(None, title='NOLCtest ' + __version__, size=(418, 180))
  19.  
  20. try:
  21.     import nolc
  22. except:
  23.     dlg = wx.MessageDialog(frame, 'You need NOLC to run this program. Get it on http://www.pastebin.com/UWCZgC50',
  24.                                'You need NOLC',
  25.                                wx.OK | wx.ICON_INFORMATION
  26.                                )
  27.     dlg.ShowModal()
  28.     dlg.Destroy()
  29.     sys.exit()
  30.  
  31. def leetfunc(self):
  32.     t2.SetValue(nolc.leet(t1.GetValue()))
  33. def leet2func(self):
  34.     t2.SetValue(nolc.leet2(t1.GetValue()))
  35. def greekfunc(self):
  36.     t2.SetValue(nolc.greek(t1.GetValue()))
  37. def flipfunc(self):
  38.     t2.SetValue(nolc.flip(t1.GetValue()))
  39. def updownfunc(self):
  40.     t2.SetValue(nolc.updown(t1.GetValue()))
  41. def messfunc(self):
  42.     t2.SetValue(nolc.mess(t1.GetValue()))
  43. def morsefunc(self):
  44.     t2.SetValue(nolc.morse(t1.GetValue()))
  45.  
  46. t1 = wx.TextCtrl(frame, -1, "Enter your input text here", size=(200, 100), style=wx.TE_MULTILINE|wx.TE_PROCESS_ENTER, pos=(0, 0))
  47. t2 = wx.TextCtrl(frame, -1, "Get your output text here", size=(200, 100), style=wx.TE_MULTILINE|wx.TE_PROCESS_ENTER|wx.TE_READONLY, pos=(201,0))
  48. leet = wx.Button(frame, -1, u"1337", size=(80,20), pos=(0, 101))
  49. leet.SetToolTipString("Leet your text")
  50. leet2 = wx.Button(frame, -1, u"£ēē†", size=(80,20), pos=(80, 101))
  51. leet2.SetToolTipString("Leet2 your text")
  52. greek = wx.Button(frame, -1, u"Gяεεκ", size=(80,20), pos=(160, 101))
  53. greek.SetToolTipString("Make your text looking greek")
  54. flip = wx.Button(frame, -1, u"dılɟ", size=(80,20), pos=(240, 101))
  55. flip.SetToolTipString("Flip it upside down")
  56. updown = wx.Button(frame, -1, u"UpDoWn", size=(80,20), pos=(320, 101))
  57. updown.SetToolTipString("Do it camelcased")
  58. mess = wx.Button(frame, -1, u"Mses", size=(80,20), pos=(0, 121))
  59. mess.SetToolTipString("Mess all mid chars of the words")
  60. morse = wx.Button(frame, -1, u"-- --- ·-· ··· ·", size=(80,20), pos=(80, 121))
  61. morse.SetToolTipString("Translate it to morse code")
  62. wx.StaticText(frame, -1, "NOLCtest " + ver + " by nucular. Public Domain.", (200, 124))
  63.  
  64. frame.Bind(wx.EVT_BUTTON, leetfunc, leet)
  65. frame.Bind(wx.EVT_BUTTON, leet2func, leet2)
  66. frame.Bind(wx.EVT_BUTTON, greekfunc, greek)
  67. frame.Bind(wx.EVT_BUTTON, flipfunc, flip)
  68. frame.Bind(wx.EVT_BUTTON, updownfunc, updown)
  69. frame.Bind(wx.EVT_BUTTON, messfunc, mess)
  70. frame.Bind(wx.EVT_BUTTON, morsefunc, morse)
  71.  
  72. frame.Show()
  73. app.MainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement