wx.SetToolTip

Hello List,

I am having a problem getting a tooltip to show up when I create it dynamically. If I set the text to some default string, it displays fine but when I set it to a variable, it doesn’t display. Any suggestions?

Here is the code I use to create the tool tip:

co_tt = s[23]

self.coVal.SetLabel (coStr[0:14])

self.coVal.SetToolTip (wx.ToolTip (co_tt))

if I were to make co_tt something like the follow:

co_tt = “Show tool tip”

It works.

Thanks for any help.

  • Steve

Is there a fixed length on the tooltip size? I am trying to print a location of a file which could be several directories deep. My intent is to only show the file name and on mouse-over show the entire path.

  • Steve
···

On Fri, Sep 3, 2010 at 10:50 AM, Steve ghostraker@gmail.com wrote:

Hello List,

I am having a problem getting a tooltip to show up when I create it dynamically. If I set the text to some default string, it displays fine but when I set it to a variable, it doesn’t display. Any suggestions?

Here is the code I use to create the tool tip:

co_tt = s[23]

self.coVal.SetLabel (coStr[0:14])

self.coVal.SetToolTip (wx.ToolTip (co_tt))

if I were to make co_tt something like the follow:

co_tt = “Show tool tip”

It works.

Thanks for any help.

  • Steve

You may need to use TipWindow for that. I don't remember there being a
fixed length for tooltips, but I wouldn't be surprised either.

···

On Sep 3, 1:05 pm, Steve <ghostra...@gmail.com> wrote:

Is there a fixed length on the tooltip size? I am trying to print a location
of a file which could be several directories deep. My intent is to only show
the file name and on mouse-over show the entire path.

- Steve

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

Hello List,

I am having a problem getting a tooltip to show up when I create it
dynamically. If I set the text to some default string, it displays fine
but when I set it to a variable, it doesn't display. Any suggestions?

Here is the code I use to create the tool tip:

co_tt = s[23]

self.coVal.SetLabel (coStr[0:14])
self.coVal.SetToolTip (wx.ToolTip (co_tt))

if I were to make co_tt something like the follow:

co_tt = "Show tool tip"

It works.

Is s[23] a string? How big is it?

Is there a fixed length on the tooltip size? I am trying to print a location of a file which could be several directories deep. My intent is to only show the file name and on mouse-over show the entire path.

On Windows at least I think that there is a limit, but I don't remember the details. I would guess that it is something like 255 characters.

···

On 9/3/10 10:50 AM, Steve wrote:

--
Robin Dunn
Software Craftsman

For me, there doesn't seem to be a reasonable size limit for tooltips
on win XP; even a string not fitting on the whole screen can be set
(e.g. str(range(2000)) which is 10890 chars).

for the original problem, I'd guess, something else than string or
unicode is being set; would it be possible to use
self.coVal.SetToolTip (wx.ToolTip (coStr)) instead of ... co_tt ? Is
it to create an abbreviated label with a complete string as tooltip?

vbr

···

2010/9/3 Robin Dunn <robin@alldunn.com>:

On 9/3/10 10:50 AM, Steve wrote:

Hello List,

I am having a problem getting a tooltip to show up when I create it
dynamically. If I set the text to some default string, it displays fine
but when I set it to a variable, it doesn't display. Any suggestions?

Here is the code I use to create the tool tip:

co_tt = s[23]

self.coVal.SetLabel (coStr[0:14])
self.coVal.SetToolTip (wx.ToolTip (co_tt))

if I were to make co_tt something like the follow:

co_tt = "Show tool tip"

It works.

Is s[23] a string? How big is it?

Is there a fixed length on the tooltip size? I am trying to print a
location of a file which could be several directories deep. My intent is to
only show the file name and on mouse-over show the entire path.

On Windows at least I think that there is a limit, but I don't remember the
details. I would guess that it is something like 255 characters.

--
Robin Dunn
Software Craftsman
http://wxPython.org

Steve,

···

On 03/09/2010 21:00, Mike Driscoll wrote:

On Sep 3, 1:05 pm, Steve<ghostra...@gmail.com> wrote:

Is there a fixed length on the tooltip size? I am trying to print a location
of a file which could be several directories deep. My intent is to only show
the file name and on mouse-over show the entire path.

- Steve

You may need to use TipWindow for that. I don't remember there being a
fixed length for tooltips, but I wouldn't be surprised either.

You might also want to look at "agw.supertooltip" - check out the wxPython demo for it (btw you will have to enlarge the dialog a bit to make the two buttons show).

Werner

Yes, s[23] is a string of about 50 characters. There are ‘/’ in it but if I code those into a string statically they display just fine. It’s very odd that it won’t work and others just like it (same paths) work when hard coded.

···

On Fri, Sep 3, 2010 at 1:46 PM, Robin Dunn robin@alldunn.com wrote:

On 9/3/10 10:50 AM, Steve wrote:

Hello List,

I am having a problem getting a tooltip to show up when I create it

dynamically. If I set the text to some default string, it displays fine

but when I set it to a variable, it doesn’t display. Any suggestions?

Here is the code I use to create the tool tip:

co_tt = s[23]

self.coVal.SetLabel (coStr[0:14])

self.coVal.SetToolTip (wx.ToolTip (co_tt))

if I were to make co_tt something like the follow:

co_tt = “Show tool tip”

It works.

Is s[23] a string? How big is it?

Is there a fixed length on the tooltip size? I am trying to print a location of a file which could be several directories deep. My intent is to only show the file name and on mouse-over show the entire path.

On Windows at least I think that there is a limit, but I don’t remember the details. I would guess that it is something like 255 characters.

Hi,
what widget is coVal ?
I tested tooltips with wx.Button and didn't hit any limitation (string
size, slashes, backslashes ...) - on win XPp.

vbr

···

2010/9/5 Steve <ghostraker@gmail.com>:

On 9/3/10 10:50 AM, Steve wrote:

Hello List,

I am having a problem getting a tooltip to show up when I create it
dynamically. If I set the text to some default string, it displays fine
but when I set it to a variable, it doesn't display. Any suggestions?

Here is the code I use to create the tool tip:

co_tt = s[23]

self.coVal.SetLabel (coStr[0:14])
self.coVal.SetToolTip (wx.ToolTip (co_tt))

Why don't you post a small runnable sample that allow others to run it
and also see the same error messages you are getting (if you're
getting any).

···

On Sun, Sep 5, 2010 at 4:18 AM, Steve <ghostraker@gmail.com> wrote:

On Fri, Sep 3, 2010 at 1:46 PM, Robin Dunn <robin@alldunn.com> wrote:

On 9/3/10 10:50 AM, Steve wrote:

Hello List,

I am having a problem getting a tooltip to show up when I create it
dynamically. If I set the text to some default string, it displays fine
but when I set it to a variable, it doesn't display. Any suggestions?

Here is the code I use to create the tool tip:

co_tt = s[23]

self.coVal.SetLabel (coStr[0:14])
self.coVal.SetToolTip (wx.ToolTip (co_tt))

if I were to make co_tt something like the follow:

co_tt = "Show tool tip"

It works.

Is s[23] a string? How big is it?

Is there a fixed length on the tooltip size? I am trying to print a
location of a file which could be several directories deep. My intent is to
only show the file name and on mouse-over show the entire path.

On Windows at least I think that there is a limit, but I don't remember
the details. I would guess that it is something like 255 characters.

Yes, s[23] is a string of about 50 characters. There are '/' in it but if I
code those into a string statically they display just fine. It's very odd
that it won't work and others just like it (same paths) work when hard
coded.

coVal is a StaticText. I will do as CM suggests and try and make a small runnable that breaks it.

  • STeve
···

On Sun, Sep 5, 2010 at 8:52 AM, Vlastimil Brom vlastimil.brom@gmail.com wrote:

2010/9/5 Steve ghostraker@gmail.com:

On 9/3/10 10:50 AM, Steve wrote:

Hello List,

I am having a problem getting a tooltip to show up when I create it

dynamically. If I set the text to some default string, it displays fine

but when I set it to a variable, it doesn’t display. Any suggestions?

Here is the code I use to create the tool tip:

co_tt = s[23]

self.coVal.SetLabel (coStr[0:14])

self.coVal.SetToolTip (wx.ToolTip (co_tt))

Hi,

what widget is coVal ?

I tested tooltips with wx.Button and didn’t hit any limitation (string

size, slashes, backslashes …) - on win XPp.