Advertisement
Guest User

wxPython question examples

a guest
Apr 19th, 2022
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. --------Example 1--------
  2.  
  3. import wx
  4.  
  5. a=wx.App()
  6. myframe = wx.Frame(None, title="Hello World", size=(500,500))
  7. myframe.Show()
  8. a.MainLoop()
  9.  
  10. --------Example 2--------
  11.  
  12. import wx
  13.  
  14.  
  15. class Textpanel(wx.StaticText):
  16.     def __init__(self, parent):
  17.         super().__init__(parent, size=(100,100), name="some name", label="dododas dasdasawda sadsa asdkpaow poaowiaed paowipg", style=wx.ALIGN_CENTRE_HORIZONTAL)
  18.         self.Wrap(100)
  19.         self.cat = "I am a cat"
  20.  
  21. class MainFrame(wx.Frame):
  22.  
  23.     def __init__(self):
  24.         super().__init__(None, title="Box", size=(500,500))
  25.         self.dog = "I am a dog"
  26.         Textpanel(self)
  27.  
  28. if __name__ == "__main__":
  29.     app = wx.App()
  30.     myframe = MainFrame()
  31.     myframe.Show()
  32.     app.MainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement