Created
May 4, 2018 10:16
-
-
Save canwe/c7bef17329d4dbc964f59ea1b42b381c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """ | |
| wx Sizer | |
| @author: Dazhuang | |
| """ | |
| import wx | |
| class Frame1(wx.Frame): | |
| def __init__(self, parent): | |
| wx.Frame.__init__(self, parent, title = "Hello World in wxPython") | |
| panel = wx.Panel(self) | |
| sizer = wx.BoxSizer(wx.VERTICAL) | |
| self.text1= wx.TextCtrl(panel, value = "Hello, World!", size = (200,180), style = wx.TE_MULTILINE) | |
| sizer.Add(self.text1, 0, wx.ALIGN_TOP | wx.EXPAND) | |
| button = wx.Button(panel, label = "Click Me") | |
| sizer.Add(button) | |
| panel.SetSizerAndFit(sizer) | |
| panel.Layout() | |
| self.Bind(wx.EVT_BUTTON,self.OnClick,button) | |
| def OnClick(self, text): | |
| self.text1.AppendText("\nHello, World!") | |
| if __name__ == '__main__': | |
| app = wx.App() | |
| frame = Frame1(None) | |
| frame.Show(True) | |
| app.MainLoop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment