forked from wxWidgets/wxPython-Classic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_navigation.py
More file actions
66 lines (48 loc) · 1.71 KB
/
Copy pathtest_navigation.py
File metadata and controls
66 lines (48 loc) · 1.71 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import wx
print wx.version()
import os; print "PID:", os.getpid()
class TestPanel(wx.Panel):
"""
A panel with a bunch of text fields in static boxes
"""
def __init__(self, *args, **kw):
wx.Panel.__init__(self, *args, **kw)
sbs1 = self.MakeGroup("One", ['aaaaa', 'bbbbb', 'ccccc'])
sbs2 = self.MakeGroup("Two", ['ddddd', 'eeeee', 'fffff'])
sbs3 = self.MakeGroup("Three", ['ggggg', 'hhhhh', 'iiiii'])
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(sbs1, 0, wx.ALL, 15)
sizer.Add(sbs2, 0, wx.ALL, 15)
sizer.Add(sbs3, 0, wx.ALL, 15)
self.SetSizer(sizer)
def MakeGroup(self, label, items):
sb = wx.StaticBox(self, label=label)
sbs = wx.StaticBoxSizer(sb, wx.VERTICAL)
fgs = wx.FlexGridSizer(cols=2, hgap=8, vgap=8)
sbs.Add(fgs, 0, wx.ALL, 8)
for item in items:
fgs.Add(wx.StaticText(self, -1, item))
fgs.Add(wx.TextCtrl(self, -1, "", size=(150,-1)))
return sbs
class TestPanel2(TestPanel):
"""
This one tests tabbing between fields on sub-panels
"""
def MakeGroup(self, label, items):
p = wx.Panel(self)
p.SetBackgroundColour('pink')
bs = wx.BoxSizer(wx.VERTICAL)
fgs = wx.FlexGridSizer(cols=2, hgap=8, vgap=8)
bs.Add(fgs, 0, wx.ALL, 8)
for item in items:
fgs.Add(wx.StaticText(p, -1, item))
fgs.Add(wx.TextCtrl(p, -1, "", size=(150,-1)))
p.SetSizer(bs)
return p
app = wx.App(redirect=False)
frm = wx.Frame(None, title="Navigation Tests")
pnl = TestPanel(frm)
#pnl = TestPanel2(frm)
pnl.Sizer.SetSizeHints(frm)
frm.Show()
app.MainLoop()