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.
Tkinter comes pre-installed with the Python installer binaries for Mac OS X and the Windows platform. So if you install Python from the official binaries for Mac OS X or Windows platform, you are good to go with Tkinter. 32-bit-only Python installers for Mac OS X dynamically link to Tcl/Tk 8.4 frameworks. In either case, the dynamically linking occurs when tkinter (Python 3) or Tkinter (Python 2) is first imported (specifically, the internal tkinter C extension module). By default, the Mac OS X dynamic linker looks first in /Library/Frameworks for Tcl and Tk frameworks with the proper major version. The trusted Tcl distribution for Windows, Linux and Mac, pre-bundled with top Tcl/Tk modules – free for development use.
We have often been asked: 'Is there no Tk for Python?' or 'Is Tkinter the same as Tk?'Of course, there is Tk for Python. Without Tk Python would be less attractive to many users.Tk is called Tkinter in Python, or to be precise, Tkinter is the Python interface for Tk.Tkinter is an acronym for 'Tk interface'.
Tk was developed as a GUI extension for the Tcl scripting language by John Ousterhout. The first release was in 1991. Tk proved as extremely successful in the 1990's, because it is easier to learn and to use than other toolkits. So it is no wonder that many programmers wanted to use Tk independently of Tcl. That's why bindings for lots of other programming languages have been developed, including Perl, Ada (called TASH), Python (called Tkinter), Ruby, and Common Lisp.
Tk provides the following widgets:
Python Tcl Tk
Tkinter For Mac
- tk_chooseColor - pops up a dialog box for the user to select a color.
- tk_chooseDirectory - pops up a dialog box for the user to select a directory.
- tk_dialog - creates a modal dialog and waits for a response.
- tk_getOpenFile - pops up a dialog box for the user to select a file to open.
- tk_getSaveFile - pops up a dialog box for the user to select a file to save.
- tk_messageBox - pops up a message window and waits for a user response.
- tk_popup - posts a popup menu.
- toplevel - creates and manipulates toplevel widgets.
Install Tkinter MacTk also provides three geometry managers:
Visual Tkinter For Mac
- place - which positions widgets at absolute locations
- grid - which arranges widgets in a grid
- pack - which packs widgets into a cavity