New submission from Mark Summerfield <[EMAIL PROTECTED]>: #Python 3.0a5 (py3k:62932M, May 9 2008, 16:23:11) [MSC v.1500 32 bit #(Intel)] on win32 # # If you run this tiny program on Linux and press Alt+F (Alt-f in Tk # terminology) the File menu pops up as expected. But run it on # Windows Home XP and nothing happens when you press Alt+F. # The problem may be with the code below since IDLE works fine on # Windows, in which case sorry! # However, Grayson's AppB/menu.py example (with suitably fixed print # statements since it was writtend for Py2) is exactly the same: # works fine on Linux but Alt+key does not invoke the menus on Windows. from Tkinter import *
class MainWindow: def __init__(self, parent): self.parent = parent menuBar = Frame(self.parent, relief=RAISED, borderwidth=2) menuBar.pack(anchor=N, fill=X) fileMenu = Menubutton(menuBar, text="File", underline=0) fileMenu.pack(side=LEFT) fileMenu.menu = Menu(fileMenu, tearoff=False) for label, command in ( ("New...", self.fileNew), ("Open...", self.fileOpen), ("Quit", self.fileQuit)): fileMenu.menu.add_command(label=label, command=command) fileMenu["menu"] = fileMenu.menu menuBar.tk_menuBar(fileMenu) def fileNew(self, *args): print("fileNew", args) def fileOpen(self, *args): print("fileOpen", args) def fileQuit(self, *args): self.parent.destroy() root = Tk() window = MainWindow(root) root.protocol("WM_DELETE_WINDOW", window.parent.destroy) root.mainloop() ---------- messages: 66492 nosy: mark severity: normal status: open title: Py30a5: Tk Menu Alt-f behaves differently Linux vs Windows type: behavior versions: Python 3.0 __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2806> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com