This section is not designed to be an exhaustive tutorial on either Tk or Tkinter. These have been renamed as well in Python 3 they were all made submodules of the new tkinter package. This is experimental and should become deprecated when it is replaced with the Tk DND. tkSimpleDialogīasic dialogs and convenience functions. tkMessageBoxĪccess to standard Tk dialog boxes. tkFileDialogĬommon dialogs to allow the user to specify a file to open or save. tkCommonDialogīase class for the dialogs defined in the other modules listed here.
tkColorChooserĭialog to let the user choose a color. Text widget with a vertical scroll bar built in. Other modules that provide Tk support include: ScrolledText Each instance has its own associated Tcl interpreter. This creates a toplevel widget of Tk which usually is the main window of an application. The Tk class is instantiated without arguments. The former automatically imports the latter, so to use Tkinter, all you need to do is to import one module: import TkinterĬlass Tkinter.Tk(screenName=None, baseName=None, className='Tk', useTk=1) The two most important modules are the Tkinter module itself, and a module called Tkconstants. In addition to the Tk interface module, Tkinter includes a number of Python modules. It is usually a shared library (or DLL), but might in some cases be statically linked with the Python interpreter. This module contains the low-level interface to Tk, and should never be used directly by application programmers. The Tk interface is located in a binary module named _tkinter. Most of the time, the Tkinter module is all you really need, but a number of additional modules are available as well. Practical Programming in Tcl and Tkīrent Welch’s encyclopedic book. Tcl and the Tk Toolkitīook by John Ousterhout, the inventor of Tcl. The Tk/Tcl development is largely taking place at ActiveState.
Recent Tcl/Tk manuals on ActiveState Tcl Home Page Change ‘8.6’ to match the version of your Tcl/Tk installation. Most commands are available as Tkinter or Tkinter.ttk classes. Modern Tkinter for Busy Python Developersīook by Mark Roseman about building attractive and modern graphical user interfaces with Python and Tkinter. Programming Pythonīook by Mark Lutz, has excellent coverage of Tkinter. Online reference for tkinter supported by.
TKDocsĮxtensive tutorial plus friendlier widget pages for some of the widgets.
The Python Tkinter Topic Guide provides a great deal of information on using Tk from Python and links to other sources of information on Tk. Tkinter documentation: Python Tkinter Resources