trouble creating tooltips using Wx in Tk canvas

Ravikanth vvnrk.vanapalli at gmail.com
Wed Jul 6 15:35:59 EDT 2011


On Jul 6, 1:32 pm, Ian Kelly <ian.g.ke... at gmail.com> wrote:
> On Wed, Jul 6, 2011 at 9:12 AM, Ravikanth <vvnrk.vanapa... at gmail.com> wrote:
> > Hi all,
> > Hi all,
>
> > I am having a trouble creating tooltips. I am trying to embed a
> > matplotlib graph inside  a TkInter canvas. After some search over the
> > net, I found out a way to create tooltips using the WXbackend.
> > But when I embed my matplotlib figure inside a Tk and  the tooltips
> > are not getting displayed.
>
> That's pretty much what I would expect, since wxPython and Tkinter are
> completely different GUI libraries.  Trying to use them together is a
> bit like trying to call a .NET function from Java -- maybe possible,
> but it's going to take a lot of work.
>
> > The error I am getting is below.
>
> > Traceback (most recent call last):
> >  File "U:\graphing_tool\plotinsideTkInter\plotInTk.py", line 12, in
> > <module>
> >    tooltip = wx.ToolTip(tip='tip with a long %s line and a newline\n'
> > % (' '*100)) # needs to be added to getover the bug with tooltip.
> >  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_misc.py",
> > line 771, in __init__
> >    _misc_.ToolTip_swiginit(self,_misc_.new_ToolTip(*args, **kwargs))
> > PyNoAppError: The wx.App object must be created first!
>
> > I am not able to figure out the reason.
>
> As it says, you haven't created the wx.App object necessary for pretty
> much all wxPython code.  You could create one, but your tooltip still
> would not work correctly because you would be running the Tkinter
> event loop rather than the wxPython event loop.  If you want to use
> the wxToolTip widget, then you should write your program to use
> wxPython only.  Alternatively, googling for "tkinter tooltip" turns up
> a couple of recipes; you could try one of those.
>
> Cheers,
> Ian

Thank you Ian for your insights to me on this.
I will migrate to wxPython to achieve the functionality.



More information about the Python-list mailing list