How to turn off tooltips in wxpython -
i have tried:
wx.tooltip.enable(false) wx.tooltip_enable(false)
and
wx.tooltip.enable(flag=false)
none of theses instructions rejected , yet none of them work
i'm using linux mint 17
wx.python 2.8.12.1 (gtk2-unicode)
python 2.7
according wxpython docs, tooltip.enable
seems to,
enable or disable tooltips globally.
note may not supported on platforms (eg. cocoa).
which assume includes platform... instead, may need set tooltips window itself. there isn't tooltop_enable
method can see window setting tooltip empty string seems trick me,
import wx app = wx.app() frame = wx.frame(none, -1, '') frame.settooltip(wx.tooltip('')) frame.setsize(wx.size(300,250)) frame.show() app.mainloop()
edit: define child tooltip class can enabled/disabled , defaults based on global value.
import wx enabletooltips = false class tooltip(wx.tooltip): '''a subclass of wx.tooltip can disabled''' def __init__(self, string, enable=enabletooltips): self.tooltip_string = string self.tooltipsenabled = enable wx.tooltip.__init__(self, string) self.enable(enable) def enable(self, x): if x true: self.settip(self.tooltip_string) self.tooltipsenabled = true elif x false: self.settip("") self.tooltipsenabled = false app = wx.app() frame = wx.frame(none, -1, '') tt = tooltip('test') frame.settooltip(tt) frame.setsize(wx.size(300,250)) frame.show() app.mainloop()
i'm not sure work dynamically (i.e. once start gui, frame tooltips have been set , changing value may not update).
Comments
Post a Comment