Underscores in menu items

I have a dynamic menu that may contain items with underscore characters. But when I call GetLabel on it, wherever the label contains an underscore, I get two of them. So 'this_is_an_example' becomes 'this__is__an__example.' What's going on?

wxPython 2.4.0.1, gtk version, Linux, python 2.2

I have a dynamic menu that may contain items with underscore
characters. But when I call GetLabel on it, wherever the label
contains an underscore, I get two of them. So 'this_is_an_example'
becomes 'this__is__an__example.' What's going on?

wxPython 2.4.0.1, gtk version, Linux, python 2.2

I'm guessing, but on Windows, if a character in the menu text is going to
be underlined (for use as the accelerator key character) then it is
preceded by an ampersand character (&) in the text. So if there is a
genuine & in the text, you need to put in, and you get back, two
consecutive ampersands. Could it be that on Linux, the same functionality
is achieved with single and double underscores?

Regards,

David Hughes
Forestfield Software Ltd
www.forestfield.co.uk

wxPython on gtk also uses the ampersand to indicate an accelerator. But it seems that something similar to what you describe is happening. I just want to make sure I get it right, because if I'm not, this seems like it might lead to some hard-to-find bugs. Thanks.

ยทยทยท

On Sat, 7 Jun 2003 07:25 +0100 (BST) dfh@forestfield.co.uk (David Hughes) wrote:

> I have a dynamic menu that may contain items with underscore
> characters. But when I call GetLabel on it, wherever the label
> contains an underscore, I get two of them. So 'this_is_an_example'
> becomes 'this__is__an__example.' What's going on?
>
> wxPython 2.4.0.1, gtk version, Linux, python 2.2

I'm guessing, but on Windows, if a character in the menu text is going to
be underlined (for use as the accelerator key character) then it is
preceded by an ampersand character (&) in the text. So if there is a
genuine & in the text, you need to put in, and you get back, two
consecutive ampersands. Could it be that on Linux, the same functionality
is achieved with single and double underscores?