I'm trying to create tooltip texts for a ribbon control. I have set the help_strings but don't know how to display them. Even if it is just a tooltip text as wxpython displays for a button would be fine for me.
I have attached the code sample (a modified version of the RibbobDemo.py) on which I would like to have the help_strings on mouseover.
I appreciate code examples or pointing references.
import wx
import wx.lib.agw.ribbon as RB
class RibbonFrame(wx.Frame):
def __init__(self, parent, id=wx.ID_ANY, title="", pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE):
wx.Frame.__init__(self, parent, id, title, pos, size, style)
self._ribbon = RB.RibbonBar(self, wx.ID_ANY)
home = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Examples", wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN))
toolbar_panel = RB.RibbonPanel(home, wx.ID_ANY, "Toolbar", wx.NullBitmap, wx.DefaultPosition,
wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
toolbar = RB.RibbonToolBar(toolbar_panel, wx.ID_ANY)
# this is just a simple tool
toolbar.AddTool(wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN), help_string=" the first tool")
toolbar.AddTool(wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_ERROR), help_string=" the second tool")
toolbar.AddTool(wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_INFORMATION), help_string=" the third tool")
toolbar.AddSeparator()
self._ribbon.Realize()
self._logwindow = wx.TextCtrl(self, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize,
wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_LEFT | wx.TE_BESTWRAP | wx.BORDER_NONE)
s = wx.BoxSizer(wx.VERTICAL)
s.Add(self._ribbon, 0, wx.EXPAND)
s.Add(self._logwindow, 1, wx.EXPAND)
self.SetSizer(s)
if __name__ == "__main__":
app = wx.PySimpleApp()
frame = RibbonFrame(None, -1, "wxPython Ribbon Sample Application", size=(800, 600))
frame.CenterOnScreen()
frame.Show()
app.MainLoop()
I got wxPython3.0 Docs and Demos installed from http://www.wxpython.org/download.php. In that, under the Advanced Generic Widgets, I found the demo for Pure-Python RibbonBar which has a tooltip text display. It displays as a usual button tooltip. However, I decided to satisfy myself by that. I thank everyone involved in compiling the docs and demos. It will be very very useful!