wxTipWindow "attached" to te scollbar - troubles (simpl code incl)

Hello!

I try “attach” tooltip to the scrollbar but this code below hanghs.
Some help neded :confused:

Windows 2k
wxPython 2.6.1.0
Python 2.4.2

···

##########################################################

import wx

-------------------------------------

class MyScrlWin(wx.ScrolledWindow):

-------------------------------------

# -------------------------------------
def __init__(self, parent):

# -------------------------------------
    wx.ScrolledWindow.__init__(self, parent, -1)
    self.SetVirtualSize((0, 20000))
    self.SetScrollRate

(0,20)
self.Bind(wx.EVT_SCROLLWIN_THUMBTRACK, self.OnTrack)
self.Bind(wx.EVT_SCROLLWIN_THUMBRELEASE, self.OnTrackEnd)
self.tipWindow = None

# -------------------------------------

def OnTrack(self, event):
# -------------------------------------
    event.Skip()
    pos = event.GetPosition()
    print "OnTrack begin, position:",pos
    toolTip = "Position: " + str(pos)

    if self.tipWindow:
      self.tipWindow.Destroy()
      self.tipWindow = None
    self.tipWindow = wx.TipWindow(self, toolTip)

    m_pos = wx.GetMousePosition()
    tt_pos = (m_pos[0]-

self.tipWindow.GetSize()[0], m_pos[1])
self.tipWindow.SetPosition(tt_pos)
print “OnTrack end”

# -------------------------------------
def OnTrackEnd(self, event):
# -------------------------------------

    event.Skip()
    print "end track"
    if self.tipWindow:
      self.tipWindow.Destroy()
      self.tipWindow = None

-------------------------------------

if name == ‘main’:
class MyApp(wx.App):
def OnInit(self):
frame = wx.Frame(None, -1, “TESTER”)
win = MyScrlWin(frame)
frame.Show(True)

  self.SetTopWindow

(frame)
return True

app = MyApp(False)
app.MainLoop()

Wojtek P wrote:

Hello!

I try "attach" tooltip to the scrollbar but this code below hanghs.
Some help neded :confused:

The problem is probably related to the fact that the wx.TipWindow captures the mouse (because it is derived from wx.PopupTransientWindow which does that.) You may be better off creating your own tip-like window using wx.PopupWindow instead.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!