[New-bugs-announce] [issue2806] Py30a5: Tk Menu Alt-f behaves differently Linux vs Windows

Mark Summerfield report at bugs.python.org
Fri May 9 23:51:56 CEST 2008

New submission from Mark Summerfield <mark at qtrac.eu>:

#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.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

    def fileNew(self, *args):
        print("fileNew", args)

    def fileOpen(self, *args):
        print("fileOpen", args)

    def fileQuit(self, *args):

root = Tk()
window = MainWindow(root)
root.protocol("WM_DELETE_WINDOW", window.parent.destroy)

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 <report at bugs.python.org>

More information about the New-bugs-announce mailing list