The Python provides the standard library Tkinter for creating the Graphical User Interface (GUI) for desktop based applications. Tkinter is pronounced as tea-kay-inter and serves as the Python interface to Tk, the GUI toolkit for Tcl/Tk. Tcl (pronounced as tickle) is a scripting language frequently used in testing, prototyping, and GUI development. Tk, on the other hand, is an open-source, cross-platform widget toolkit utilized by various programming languages to construct GUI programs. Python implements Tkinter as a module, serving as a wrapper for C extensions that utilize Tcl/Tk libraries. Tkinter allows you to develop desktop applications, making it a valuable tool for GUI programming in Python. Developing desktop based applications with python Tkinter is not a complex task.
The Python Efficiently managing the geometry of Tkinter windows and widgets is essential for creating polished user interfaces. In this section, we'll cover everything from setting window dimensions to handling resizing, padding, and widget positioning. We'll explore methods like place(), grid(), and pack() to help you create organized and responsive layouts. Additionally, we'll delve into advanced techniques like the PanedWindow widget.
The pack() widget is used to organize widget in the block. The positions widgets added to the python application using the pack() method can be controlled by using the various options specified in the method call.
The grid() geometry manager organizes the widgets in the tabular form. We can specify the rows and columns as the options in the method call. We can also specify the column span (width) or rowspan(height) of a widget.
The place() geometry manager organizes the widgets to the specific x and y coordinates.
| tkinter | Main Tkinter module. |
| tkinter.colorchooser | Dialog to let the user choose a color. |
| tkinter.commondialog | Base class for the dialogs defined in the other modules listed here. |
| tkinter.filedialog | Common dialogs to allow the user to specify a file to open or save. |
| tkinter.font | Utilities to help work with fonts. |
| tkinter.messagebox | Access to standard Tk dialog boxes. |
| tkinter.scrolledtext | Text widget with a vertical scroll bar built in. |
| tkinter.simpledialog | Basic dialogs and convenience functions. |
| tkinter.ttk | Themed widget set introduced in Tk 8.5, providing modern alternatives for many of the classic widgets in the main tkinter module. |
| tkinter.constants | Symbolic constants that can be used in place of strings when passing various parameters to Tkinter calls. Automatically imported by the main tkinter module. |
| tkinter.dnd | Drag-and-drop support for tkinter. This will become deprecated when it is replaced with the Tk DND. |
| turtle | Turtle graphics in a Tk window. |
| S.No | Widget | Description |
|---|---|---|
| 1 | Button | The Button is used to add various kinds of buttons to the python application. |
| 2 | Canvas | The canvas widget is used to draw the canvas on the window. |
| 3 | Checkbutton | The Checkbutton is used to display the CheckButton on the window. |
| 4 | Entry | The entry widget is used to display the single-line text field to the user. It is commonly used to accept user values. |
| 5 | Frame | It can be defined as a container to which, another widget can be added and organized. |
| 6 | Label | A label is a text used to display some message or information about the other widgets. |
| 7 | ListBox | The ListBox widget is used to display a list of options to the user. |
| 8 | Menubutton | The Menubutton is used to display the menu items to the user. |
| 9 | Menu | It is used to add menu items to the user. |
| 10 | Message | The Message widget is used to display the message-box to the user. |
| 11 | Radiobutton | The Radiobutton is different from a checkbutton. Here, the user is provided with various options and the user can select only one option among them. |
| 12 | Scale | It is used to provide the slider to the user. |
| 13 | Scrollbar | It provides the scrollbar to the user so that the user can scroll the window up and down. |
| 14 | Text | It is different from Entry because it provides a multi-line text field to the user so that the user can write the text and edit the text inside it. |
| 15 | Toplevel | It is used to create a separate window container. |
| 16 | Spinbox | It is an entry widget used to select from options of values. |
| 17 | PanedWindow | It is like a container widget that contains horizontal or vertical panes |
| 18 | LabelFrame | A LabelFrame is a container widget that acts as the container |
| 19 | MessageBox | This module is used to display the message-box in the desktop based applications. |