How to create a static box sizer (Phoenix)
Keywords : Static box sizer.
Contents
Demonstrating :
Tested py3.x, wx4.x and Win10.
Are you ready to use some samples ?
Test, modify, correct, complete, improve and share your discoveries !
Sample one
1 # sample_one.py
2
3 """
4
5 https://discuss.wxpython.org/t/staticboxsizer-question/23987/3
6
7 """
8
9 import wx
10
11 # class MyFrame
12
13 #---------------------------------------------------------------------------
14
15 class MyFrame(wx.Frame):
16 def __init__(self):
17 wx.Frame.__init__(self, None, -1, "wx.StaticBoxSizer", size=(300,150))
18
19 self.SetIcon(wx.Icon('./icons/icon_wxWidgets.ico', wx.BITMAP_TYPE_ICO))
20 self.SetMinSize((300,150))
21
22 #------------
23
24 self.panel = wx.Panel(self)
25
26 box = wx.StaticBox(self.panel, -1, "Label text here :")
27
28 txt = wx.StaticText(self.panel, -1,
29 "Some other text here.\n"
30 "Some other text here.\nSome other text here.\n"
31 "Some other text here. Some other text here. Some other....")
32
33 #------------
34
35 sizer = wx.BoxSizer(wx.HORIZONTAL)
36 psizer = wx.BoxSizer(wx.VERTICAL)
37 bsizer = wx.StaticBoxSizer(box, wx.VERTICAL)
38
39 sizer.Add(self.panel, 1, wx.EXPAND)
40 psizer.Add(bsizer, 1, wx.EXPAND|wx.ALL, 10)
41 bsizer.Add(txt, proportion=1, flag=wx.ALL, border=10)
42
43 self.panel.SetSizer(psizer)
44 self.SetSizer(sizer)
45 self.Fit()
46
47 #---------------------------------------------------------------------------
48
49 if __name__ == '__main__':
50 app = wx.App(False)
51 frm = MyFrame()
52 frm.Show(True)
53 app.MainLoop()
Download source
Additional Information
Link :
- - - - -
https://wiki.wxpython.org/TitleIndex
Thanks to
Robin Dunn (sample_one.py coding), the wxPython community...
About this page
Date(d/m/y) Person (bot) Comments :
07/01/21 - Ecco (Created page for wxPython Phoenix).
Comments
- blah, blah, blah....