在本文中,我們將學習與wxPython的wx.StaticLine類關聯的IsVertical()方法。 IsVertical()函數是一個簡單函數,用於在直線為垂直時返回True,在水平時為False。
用法: wx.StaticLine.IsVertical(self)
參數IsVertical()方法不需要任何參數。
返回類型:布爾
代碼示例:
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)
# list of choices
hlist = ['Item One', 'Item Two']
vlist =['Item One', 'Item Two']
# create vertical line from point (50, 0) t0 (50, 250)
self.sl = wx.StaticLine(pnl, 2, pos =(50, 0), size = (1, 250),
style = wx.LI_VERTICAL)
# print True if static line is vertical False otherwise
print (self.sl.IsVertical())
# 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()
控製台輸出:
True
輸出窗口:
相關用法
- wxPython wx.ToolBar SetToolShortHelp()用法及代碼示例
- wxPython wx.StatusBar SetBackgroundColour()用法及代碼示例
- wxPython wx.StatusBar SetStatusText()用法及代碼示例
- wxPython wx.ToolBar SetToolSeparation()用法及代碼示例
- wxPython wx.StatusBar SetStatusWidths()用法及代碼示例
- wxPython wx.ToolBar ToggleTool()用法及代碼示例
- wxPython wx.ToolBar SetMargins()用法及代碼示例
- wxPython wx.ToolBar AddRadioTool()用法及代碼示例
- wxPython wx.ToolBar AddStretchableSpace()用法及代碼示例
- wxPython wx.ToolBar GetToolsCount()用法及代碼示例
- wxPython wx.ToolBar SetToolLongHelp()用法及代碼示例
- wxPython wx.ToolBar SetToolDisabledBitmap()用法及代碼示例
注:本文由純淨天空篩選整理自RahulSabharwal大神的英文原創作品 wxPython – IsVertical() function in wx.StaticLine。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。