support unicode in menu items

This commit is contained in:
Just van Rossum 2003-01-09 23:18:39 +00:00
parent addc11edf0
commit f07518ac22
1 changed files with 4 additions and 1 deletions

View File

@ -561,7 +561,10 @@ class Menu:
self.menu.AppendMenu('x') # add a dummy string self.menu.AppendMenu('x') # add a dummy string
self.items.append((label, shortcut, callback, kind)) self.items.append((label, shortcut, callback, kind))
item = len(self.items) item = len(self.items)
self.menu.SetMenuItemText(item, label) # set the actual text if isinstance(label, unicode):
self.menu.SetMenuItemTextWithCFString(item, label)
else:
self.menu.SetMenuItemText(item, label)
if shortcut and type(shortcut) == type(()): if shortcut and type(shortcut) == type(()):
modifiers, char = shortcut[:2] modifiers, char = shortcut[:2]
self.menu.SetItemCmd(item, ord(char)) self.menu.SetItemCmd(item, ord(char))