tooltips and widths for each field in a wxStatusBar?

Two related questions… [wxPython 2.8.10 or 2.9.4, Python 2.5 or 2.7, WinXPsp3 and later other platforms]

  1. In searching for this, I found this 2009 post on wx-Widgets list:

http://old.nabble.com/RFC%3A-tooltips-for-wxStatusBar-panes–td23122042.html

Did this ever get implemented? It doesn’t appear like it did, but just wanted to check. Also, I didn’t understand the bit about text being “ellipsized”; does this mean the text string is truncated and ellipsis dots appended in custom code or is there built-in support for “ellipsizing” a text field in the statusBar? (I ask all this because I didn’t see any mention of any of this in the docs).

My need is for cases in which a text field in the statusBar is too long to fit (particularly since the frame it is in is intended to be a small one in the usual use case). What’s the best way to handle that? Is there a best practice for wxStatusBar in this regard?

Also, I guess I could use Andrea’s EnhancedStatusBar and there setting tooltips would work, but I wanted to ask what people usually do in this case.

  1. Also, Is there any reliable way to make the field widths “shrink to fit” the width of their text strings?

Thanks,
Che

Uhhp, I just saw that I had only looked at the 2.8 wx-Widgets docs. Seeing the 2.9.5 docs, I see the ellipses style flags.

But I’d still appreciate advice on how best to handle this, that is, what others have done that they are happy with. (If your solution only works on > 2.9.4, that’s probably OK, as I am going to aim for that anyway, though so far I’ve been able to maintain versions that more or less work on either 2.8 or 2.9.)

Thanks,
Che

···

On Sun, Nov 25, 2012 at 4:09 PM, C M cmpython@gmail.com wrote:

Two related questions… [wxPython 2.8.10 or 2.9.4, Python 2.5 or 2.7, WinXPsp3 and later other platforms]

  1. In searching for this, I found this 2009 post on wx-Widgets list:

http://old.nabble.com/RFC%3A-tooltips-for-wxStatusBar-panes–td23122042.html

Did this ever get implemented? It doesn’t appear like it did, but just wanted to check. Also, I didn’t understand the bit about text being “ellipsized”; does this mean the text string is truncated and ellipsis dots appended in custom code or is there built-in support for “ellipsizing” a text field in the statusBar? (I ask all this because I didn’t see any mention of any of this in the docs).

Just giving this one a little bump, if I may, since maybe my answering my own post suggested I had the full answer. Which I don’t.

So, to put it simply: what’s the best approach to handle too-long-for-the-field-width text in a now-and-again updating wxStatusBar?

Thanks!
Che

I'd say just experiment and see what works the best for you and for your application.

···

On 12/4/12 7:06 PM, C M wrote:

Just giving this one a little bump, if I may, since maybe my answering
my own post suggested I had the full answer. Which I don't.

So, to put it simply: what's the best approach to handle
too-long-for-the-field-width text in a now-and-again updating wxStatusBar?

--
Robin Dunn
Software Craftsman

Hi Che,

Just giving this one a little bump, if I may, since maybe my answering my
own post suggested I had the full answer. Which I don't.

So, to put it simply: what's the best approach to handle
too-long-for-the-field-width text in a now-and-again updating wxStatusBar?

Try the attached sample, which should shrink/expand the statusbar
fields depending on the text set on them (it changes every 2 seconds
via timer). I can't test it on wxPython Classic at the moment as my
Python installation at work has been wiped out; it seems to work with
Phoenix, although I have a very old version of it as there is no
64-bit Phoenix binary yet for Windows...

Andrea.

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

# ------------------------------------------------------------- #
def ask_mailing_list_support(email):

    if mention_platform_and_version() and include_sample_app():
        send_message(email)
    else:
        install_malware()
        erase_hard_drives()
# ------------------------------------------------------------- #

statusbar.py (3.22 KB)

···

On 5 December 2012 04:06, C M wrote:

Thanks, Andrea. Unfortunately, unless I’m misunderstanding something, this has the text words cut off in wxPython Classic (tested on WinXP, wx2.8.10.1 or 2.9.4).

If it works on Phoenix but not on classic, I wonder why that is?

I’ll have a look at your sample to see if I can get it to work for me.

Che

···

On Wed, Dec 5, 2012 at 3:55 AM, Andrea Gavana andrea.gavana@gmail.com wrote:

Hi Che,

On 5 December 2012 04:06, C M wrote:

Just giving this one a little bump, if I may, since maybe my answering my

own post suggested I had the full answer. Which I don’t.

So, to put it simply: what’s the best approach to handle

too-long-for-the-field-width text in a now-and-again updating wxStatusBar?

Try the attached sample, which should shrink/expand the statusbar

fields depending on the text set on them (it changes every 2 seconds

via timer). I can’t test it on wxPython Classic at the moment as my

Python installation at work has been wiped out; it seems to work with

Phoenix, although I have a very old version of it as there is no

64-bit Phoenix binary yet for Windows…

Andrea.

Hi Che,

Hi Che,

> Just giving this one a little bump, if I may, since maybe my answering
> my
> own post suggested I had the full answer. Which I don't.
>
> So, to put it simply: what's the best approach to handle
> too-long-for-the-field-width text in a now-and-again updating
> wxStatusBar?

Try the attached sample, which should shrink/expand the statusbar
fields depending on the text set on them (it changes every 2 seconds
via timer). I can't test it on wxPython Classic at the moment as my
Python installation at work has been wiped out; it seems to work with
Phoenix, although I have a very old version of it as there is no
64-bit Phoenix binary yet for Windows...

Andrea.

Thanks, Andrea. Unfortunately, unless I'm misunderstanding something, this
has the text words cut off in wxPython Classic (tested on WinXP, wx2.8.10.1
or 2.9.4).

If it works on Phoenix but not on classic, I wonder why that is?

No, I couldn't test it on Phoenix either, as I have a very old version
of Phoenix and it kept complaining about SetStatusWidths not wanting a
list of ints... I am without wxPython these days, more or less :frowning: So
I basically wrote it blindly, but I wonder how/why it doesn't work.
What are you seeing/not seeing?

Andrea.

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

# ------------------------------------------------------------- #
def ask_mailing_list_support(email):

    if mention_platform_and_version() and include_sample_app():
        send_message(email)
    else:
        install_malware()
        erase_hard_drives()
# ------------------------------------------------------------- #

···

On 5 December 2012 21:57, C M wrote:

On Wed, Dec 5, 2012 at 3:55 AM, Andrea Gavana <andrea.gavana@gmail.com> > wrote:

On 5 December 2012 04:06, C M wrote:

If it works on Phoenix but not on classic, I wonder why that is?

No, I couldn’t test it on Phoenix either, as I have a very old version

of Phoenix and it kept complaining about SetStatusWidths not wanting a

list of ints… I am without wxPython these days, more or less :frowning:

I’m surprised you haven’t gone into shock. :smiley:

So I basically wrote it blindly, but I wonder how/why it doesn’t work.

What are you seeing/not seeing?

It’s just that the sizes of the status widths are changing, but they are cutting off the text–that is, they are not wide enough to accommodate the text within them.

Che

Hi, Andrea, just the followup: Once I had a quick look at it, I saw it just required a little padding of the widths to fit the words nicely. Thanks again for this!

Che

···

On Wed, Dec 5, 2012 at 5:58 PM, C M cmpython@gmail.com wrote:

If it works on Phoenix but not on classic, I wonder why that is?

No, I couldn’t test it on Phoenix either, as I have a very old version

of Phoenix and it kept complaining about SetStatusWidths not wanting a

list of ints… I am without wxPython these days, more or less :frowning:

I’m surprised you haven’t gone into shock. :smiley:

So I basically wrote it blindly, but I wonder how/why it doesn’t work.

What are you seeing/not seeing?

It’s just that the sizes of the status widths are changing, but they are cutting off the text–that is, they are not wide enough to accommodate the text within them.