[pygtk] Avoid interpretation of char '_' in itemfactory

Doug Quale quale1 at charter.net
Sat Mar 20 05:47:41 WST 2004


Maik Hertha <maik.hertha at berlin.de> writes:

> Unfortunately  the itemfactory  interprets  the  char  '_'  as
> accelerator marker vor the following char.
> So my question is. How could I avoid the interpretation of the char
> '_' (underscore) as accelecation marker in the  menu item ('DLName
> "%s"') ?

Double the underscore and the menu should display a single underscore
instead of creating an accelerator.  The replace() method should work:

        dl.replace('_', '__')

This is mentioned in the GTK+ documentation under the
gtk_label_new_with_mnemonic() function.  Of course this probably isn't
the first place someone would look, although there is a pointer from
the docs on gtk_menu_item_new_with_mnemonic():

http://developer.gnome.org/doc/API/2.0/gtk/GtkLabel.html#gtk-label-new-with-mnemonic


More information about the pygtk mailing list