@@ -82,11 +82,13 @@ def _init_toolbar(self):
8282
8383 # create a long tooltip with newline to get around wx bug (in v2.6.3.3)
8484 # where newlines aren't recognized on subsequent self.tooltip.SetTip() calls
85- self .tooltip = wx . ToolTip (tip = 'tip with a long %s line and a newline\n ' )
85+ self .tooltip = ToolTip (tip = 'tip with a long %s line and a newline\n ' )
8686 self .canvas .SetToolTip (self .tooltip )
87- self .tooltip .Enable (False )
87+ # self.tooltip.Enable(False)
8888 self .tooltip .SetDelay (0 )
8989
90+ self .pointPick = self .canvas .mpl_connect ('pick_event' , self ._onPick )
91+
9092
9193
9294 self .Realize ()
@@ -309,7 +311,7 @@ def _onPick(self, event):
309311 #tip = '(%s, %s)' % (xValue.strftime("%b %d, %Y %H:%M:%S"), yValue)
310312 tip = '(%s, %s)' % (xValue .strftime ("%b %d, %Y %H:%M" ), yValue )
311313
312- self .tooltip .SetTip (tip )
314+ self .tooltip .SetString (tip )
313315 self .tooltip .Enable (True )
314316 self .tooltip .SetAutoPop (10000 )
315317
@@ -348,6 +350,7 @@ def home(self, event):
348350
349351
350352
353+
351354 def on_scroll_zoom (self , event ):
352355 axes = self .canvas .figure .axes [0 ]
353356 base_scale = 1.2
@@ -378,3 +381,22 @@ def on_scroll_zoom(self, event):
378381 # fig = ax.get_figure() # get the figure of interest
379382 # attach the call back
380383
384+
385+ class ToolTip (wx .ToolTip ):
386+ """
387+ a subclass of wx.Tooltip which can be disable on mac
388+ """
389+
390+ def __init__ (self , tip ):
391+ self .tooltip_string = tip
392+ self .TooltipsEnabled = True
393+ wx .ToolTip .__init__ (self , tip )
394+
395+ def SetString (self , tip ):
396+ self .tooltip_string = tip
397+
398+ def Enable (self , x ):
399+ print ("in custom tooltip set enable" )
400+ if x : self .SetTip (self .tooltip_string )
401+ else : self .SetTip ("" )
402+
0 commit comments