[wxPython-users] Custom tooltip issues

Andrea Gavana andrea.gavana at gmail.com
Fri Sep 15 17:18:27 PDT 2006


Hello Chris,

> I have a few  particular issues, maybe someone has some ideas of how to
> improve them. Enclosed is a small demo app. It has two panels, each with
> slightly different tooltip behavior attempted.
> The top panel shows a tooltip when the mouse is clicked. This works OK.
> However, getting it to go away is a trick. I tried to use:

Well, maybe it is too late for me in the evening to wxPythoning, but I
am unable to get any tooltip visible. If I click on the top panel, I
get a very fast flash of a tooltip that suddenly disappears.

> I also tried to have the TipWindow destroyed when the mouse left the
> window, but it seems I don't get the EVT_LEAVE_WINDOW when the tooltip
> is active -- weird. I also don't know how to make it go away -- should
> .Destroy() work?

Uhm, you should check if hasattr(self, "tooltip") or you will get a
bunch of AttributeErrors. However, after fixing this, I don't see any
tooltip anywhere, no matter if I click, or wait without moving the
mouse... weird, what's wrong with tooltips?!?!
However, I don't think that the call to Destroy() is safe, I get a lot
of PyDeadObjectErrors... maybe wx.TipWindow behaves like wx.BusyInfo?
You may try to call "del self.tooltip" to see if anything changes.

> The bottom Panel has a tooltip that shows the mouse coords. Ideally it
> would follow the mouse around. I think that works on Windows, but on
> wxGTK, it follows the x-coord, but stays at the bottom of the Panel. Can
> I fix that?

I can't see any tooltip :-(
This is Windows XP, wxPython 2.7.0.1 latest pre-release, Python 2.4.3.

> If none of this can be made to work right, is it possible to make a
> Custom pop-up Window that looks like a tooltip?

You may take a look at the BalloonTip control I wrote few months ago.

http://xoomer.alice.it/infinity77/eng/freeware.html#balloontip

Ok, it displays ballon-type tips, but this is easily changed. The only
problem I see with custom tooltips, is that they will almost surely
steal the focus from your widget/app, unless you restore the focus
where it was...

Andrea.


"Imagination Is The Only Weapon In The War Against Reality."

http://xoomer.virgilio.it/infinity77/




More information about the wxpython-users mailing list