📜  wxPython – GetBordersForSizer() 方法

📅  最后修改于: 2022-05-13 01:54:49.568000             🧑  作者: Mango

wxPython – GetBordersForSizer() 方法

在本文中,我们将了解与 wxPython 的 wx.StaticBox 类关联的 GetBordersForSizer() 方法。 GetBordersForSizer() 是一个简单的函数,用于返回静态框内边框可能需要的额外空间。

返回类型:元组
返回: (borderTop,borderOther)
代码示例:

Python3
import wx
 
 
class FrameUI(wx.Frame):
 
    def __init__(self, parent, title):
        super(FrameUI, self).__init__(parent, title = title, size =(300, 200))
 
        # function for in-frame components
        self.InitUI()
 
    def InitUI(self):
        # parent panel for radio box
        pnl = wx.Panel(self)
 
 
        # create static box
        self.sb = wx.StaticBox(pnl, 2, label ="Static Box",
                               pos =(20, 20), size =(100, 100))
 
        # extra space for border
        print(self.sb.GetBorderdForSize())
 
        # set frame in centre
        self.Centre()
        # set size of frame
        self.SetSize((400, 250))
        # show output frame
        self.Show(True)
 
 
 
# wx App instance
ex = wx.App()
# Example instance
FrameUI(None, 'RadioButton and RadioBox')
ex.MainLoop()


控制台输出:

(0, 0)

输出窗口: