StaticBoxSizer Test : StaticBoxSizer « wxPython « Python Tutorial

Home
Python Tutorial
1.Introduction
2.Data Type
3.Statement
4.Operator
5.String
6.Tuple
7.List
8.Dictionary
9.Collections
10.Function
11.Class
12.File
13.Buildin Function
14.Buildin Module
15.Database
16.Regular Expressions
17.Thread
18.Tkinker
19.wxPython
20.XML
21.Network
22.CGI Web
23.Windows
Python Tutorial » wxPython » StaticBoxSizer 
19.39.1.StaticBoxSizer Test
StaticBoxSizer Test
import wx

labels = "one two three four five six seven eight nine".split()

class TestFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1"StaticBoxSizer Test")
        self.panel = wx.Panel(self)

        box1 = self.MakeStaticBoxSizer("Box 1", labels[0:3])
        box2 = self.MakeStaticBoxSizer("Box 2", labels[3:6])
        box3 = self.MakeStaticBoxSizer("Box 3", labels[6:9])

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(box1, 0, wx.ALL, 10)
        sizer.Add(box2, 0, wx.ALL, 10)
        sizer.Add(box3, 0, wx.ALL, 10)
        
        self.panel.SetSizer(sizer)
        sizer.Fit(self)


    def MakeStaticBoxSizer(self, boxlabel, itemlabels):
        box = wx.StaticBox(self.panel, -1, boxlabel)
        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)

        for label in itemlabels:
            bw = wx.Button(self.panel, label=label)
            sizer.Add(bw, 0, wx.ALL, 2)

        return sizer


app = wx.PySimpleApp()
TestFrame().Show()
app.MainLoop()
19.39.StaticBoxSizer
19.39.1.StaticBoxSizer TestStaticBoxSizer Test
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.