I wrote a Python program for business for friends and use Tkinter for the interface. So far, all functions have been added to the main program window, but now I add a print function, create a simple "File" menu and want to add a "Print" entry to this menu, including displaying the corresponding key combination.
On my Mac, I want the shortcut to be Command-P. I found the meaning of the "Unicode" Mac command character and tried various ways to create an accelerator string that simply combines this character and the letter "P", but nothing works. I get either a character or a letter to display in the menu next to "Print", but never both.
Here is a complete line of code that adds a menu item, with the last attempt to build a line (I believe I found this unicode.join parameter unicode.join in the stack overflow):
sub_menu.add_command(label="Print", command=self.print_, accelerator=unicode.join(u"\u2318", u"P")) // Only the "P" displays
Here are some of the other options I've tried (lines for shortening lines). With each of these options, only the "command" symbol appears:
accelerator=u"\u2318\u0050" accelerator=u"\u2318" + "P" accelerator=u"\u2318" + u"P" accelerator=u"\u2318P" accelerator=u"".join([u"\u2318", u"P"])
So far, I have not had much to understand about Unicode strings, so maybe I am doing something wrong in this regard. However, all the attempts that I made came as a result of various searches, both here and elsewhere, and so far nothing has worked. Any understanding of how to make this work would be very welcome!
Python 2.7.3, Mac OS X 10.8.3