Hi,
If you're using the gtk item factory, then I think you can just put an _
before the letter you want underscored. E.g., send "_File".
I didn't write the code I'm looking at but it looks like we create a
GtkItemFactory like this:
accel_group = gtk.GtkAccelGroup()
self.fItemFactory = gtk.GtkItemFactory(gtk_type, '<tmp%s>'%id(self),
accel_group)
And then create the items like this:
if defn.fLabel != None:
disp_path = '/' + RemoveSlash(defn.fLabel)
item_type = ''
else:
disp_path = '/sep'
item_type = '<Separator>'
item = (disp_path, '', self.__CB_ItemActivate, 0, item_type)
self.fItemFactory.create_items([item])
We access the item like this:
menu_item = self.fItemFactory.get_widget(RemoveUnderscore(disp_path))
Where RemoveUnderscore are RemoveSlash are this:
def RemoveUnderscore(s):
""" Remove any underscore chars from given string. """
parts = string.split(s, '_')
retval = parts[0]
for part in parts[1:]:
retval = str(retval) + str(part)
return retval
def RemoveSlash(s):
""" Remove any underscore chars from given string. """
parts = string.split(s, '/')
return string.join(parts, '')
Hope that helps...
- Stephan
------------------------------
On Mon, 8 May 2000 [EMAIL PROTECTED] wrote:
> Greetings,
>
> Does anybody know how to put underscores under a selected letter
> of the items in a menu bar ? (You know the now traditional _File
> -underscore under F- means <alt>F should pop-down the File menu...
>
> By the way I do not want to add an explicit accelerator which will yield
> to ALT+ Whaterver in the menu
>
>
> Thanks all
>
> _____________________________________________________________
>
> LaBoufarikoise
>
>
> -
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
>
-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]