-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirst_wx.py
More file actions
48 lines (33 loc) · 845 Bytes
/
first_wx.py
File metadata and controls
48 lines (33 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
'''
import wx
app = wx.App()
frame = wx.Frame(None, -1, title='what.py', pos=(400,230), size=(200,146))
frame.Show()
app.MainLoop()
'''
'''
import wx
class Example(wx.Frame):
def __init__(self, title):
super().__init__(None, title=title, size=(600, 350))
self.Center()
self.Show()
if __name__ == '__main__':
app = wx.App()
Example("Shape")
app.MainLoop()
'''
import wx
class Example(wx.Frame):
def __init__(self, title):
super().__init__(None, title=title, size=(250, 150))
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Center()
self.Show()
def OnPaint(self, e):
dc = wx.PaintDC(self)
dc.DrawLines(((40, 50), (90, 50), (90, 100), (40, 100), (40, 50)))
if __name__ == "__main__":
app = wx.App()
Example('Line')
app.MainLoop()