Comment créer et ajouter une action à une commande d'un menu Tkinter en Python 3 version Windows. Nous commençons par créer un menu principal contenant plusieurs commandes et ensuite on crée une action dont le but de l'associer à une commande du menu principal. Dans le présent exemple on crée une action permettant de lancer l'explorateur Windows pour ouvrir des fichiers et associer cette action à la commande ouvrir du menu Fichier.
NB : Ce tutoriel a été crée avec l'IDE Wing sous Windows 10.
How to create and add an action to a command of a Tkinter menu in Python 3 Windows version. We start by creating a main menu containing several commands and then we create an action whose purpose is to associate it with a command of the main menu. In this example, an action is created allowing you to launch Windows Explorer to open files and associate this action with the Open command in the File menu.
NB: This tutorial was created with the Wing IDE on Windows 10.
Tkinter is Python's de-facto standard GUI (Graphical User Interface) package. It is a thin object-oriented layer on top of Tcl / Tk.
Tkinter is not the only GuiProgramming toolkit for Python. It is however the most commonly used one. CameronLaird calls the yearly decision to keep TkInter "one of the minor traditions of the Python world."
Tkinter Documentation
Python and Tkinter Programming by John Grayson (see also GuiBooks). This book just recently came back into print on demand, see the publisher's website.
Python GUI with Tkinter is a complete tutorial that covers all the widgets for the Tkinter library, complete with examples.
Thinking in Tkinter is an introduction to some basic Tkinter programming concepts.
TkDocs Tutorial, official Tkinter documentation that covers Python 3+ and Tk8.5, with easy to follow examples.
Graphical User Interfaces with Tk, a chapter from the Python Documentation.
Online Tcl / Tk Manual Pages - the official man pages at the Tcl Developer Xchange.
Tips for Python / Tk by Andreas Balogh (about useful documentation, GUI builders and tips using Grid and HList widgets).
The New Mexico Institute of Mining and Technology created its own Tkinter manual. It is available in HTML and PDF.
The Tkinter Life Preserver, by Matt Conway is still useful, though way out of date. It's the only document that explains how to read the Tcl / Tk manuals and translate the information there to Tkinter calls. HTML version, converted by Ken Manheimer.