Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8969

Re: trouble creating tooltips using Wx in Tk canvas

References <e24f3835-8ff5-4163-a797-d8ec11f0327b@r2g2000vbj.googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2011-07-06 12:32 -0600
Subject Re: trouble creating tooltips using Wx in Tk canvas
Newsgroups comp.lang.python
Message-ID <mailman.713.1309977210.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Jul 6, 2011 at 9:12 AM, Ravikanth <vvnrk.vanapalli@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

trouble creating tooltips using Wx in Tk canvas Ravikanth <vvnrk.vanapalli@gmail.com> - 2011-07-06 08:12 -0700
  Re: trouble creating tooltips using Wx in Tk canvas Ian Kelly <ian.g.kelly@gmail.com> - 2011-07-06 12:32 -0600
    Re: trouble creating tooltips using Wx in Tk canvas Ravikanth <vvnrk.vanapalli@gmail.com> - 2011-07-06 12:35 -0700
      Re: trouble creating tooltips using Wx in Tk canvas Kevin Walzer <kw@codebykevin.com> - 2011-07-06 21:04 -0400

csiph-web