Skip to content

Commit 4baa978

Browse files
added a demo of just buttons...
1 parent 8932c37 commit 4baa978

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

JustButton.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env python
2+
3+
import wx
4+
import wx.lib.buttons
5+
6+
class ButtonPanel(wx.Panel):
7+
def __init__(self, *args, **kwargs):
8+
wx.Panel.__init__(self, *args, **kwargs)
9+
10+
btn = wx.Button(self, label = "Push Me", pos=(40,60), size=(120,-1))
11+
btn = wx.Button(self, label = "Push Me Also", pos=(80,30), size=(200, 60))
12+
btn = wx.Button(self, label = "No, push me!", pos=(90,110), size=(65, 80))
13+
btn = wx.lib.buttons.GenButton(self, label = "better?", pos=(40,150), size=(60, 60))
14+
15+
btn.Bind(wx.EVT_BUTTON, self.OnButton )
16+
17+
def OnButton(self, evt):
18+
print "Button Clicked"
19+
20+
21+
class DemoFrame(wx.Frame):
22+
""" This frame displays a panel with a button] """
23+
def __init__(self, title = "Micro App"):
24+
wx.Frame.__init__(self, None , -1, title)
25+
26+
pnl = ButtonPanel(self)
27+
28+
self.Bind(wx.EVT_CLOSE, self.OnQuit)
29+
30+
31+
def OnQuit(self,Event):
32+
self.Destroy()
33+
34+
35+
app = wx.App(False)
36+
frame = DemoFrame()
37+
frame.Show()
38+
app.MainLoop()
39+
40+
41+
42+
43+

MicroApp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(self, title = "Micro App"):
3939

4040
self.SetMenuBar(MenuBar)
4141

42-
btn = wx.Button(self, label = "Quit")
42+
btn = wx.Button(self, label = "Quit", pos=(40,60))
4343

4444
btn.Bind(wx.EVT_BUTTON, self.OnQuit )
4545

0 commit comments

Comments
 (0)