📜  wxPython |使用Python的 GetToolLongHelp()函数

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

wxPython |使用Python的 GetToolLongHelp()函数

在本文中,我们将了解 wxPython 的 wx.ToolBar 类中存在的 GetToolLongHelp()函数。 GetToolLongHelp()函数返回给定工具的长帮助。它只需要一个参数,即 toolid(相关工具的 ID,传递给 AddTool )。

代码示例 1:

wx.GetToolLongHelp(self, toolid)

输出:

string

代码示例 2:

import wx
  
  
class Example(wx.Frame):
    global count
    count = 0;
  
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
  
        self.InitUI()
  
    def InitUI(self):
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        pnl = wx.Panel(self)
        self.toolbar = self.CreateToolBar()
        self.toolbar.SetMargins(10, 10)
        # Add Tools Using AddTool function
        rtool = self.toolbar.AddLabelTool(id = 13, label = "Tool one", bitmap = wx.Bitmap('wrong.png'), shortHelp ="short help 1", longHelp = "Long help associated with simple tool 1")
        stool = self.toolbar.AddLabelTool(id = 14, label = "Tool two", bitmap = wx.Bitmap('wrong.png'), shortHelp ="short help 2", longHelp = "Long help associated with simple tool 2")
  
        self.toolbar.Realize()
        self.SetSize((350, 250))
        self.SetTitle('Control')
        self.Centre()
  
        bl = self.toolbar.GetToolLongHelp(13)
  
        # print tool longHelp string
        print(bl)
  
  
def main():
    app = wx.App()
    ex = Example(None)
    ex.Show()
    app.MainLoop()
  
  
if __name__ == '__main__':
    main()

输出:

Long help associated with simple tool 1