Python GUI Programming provides several different options for writing GUI based programs. These are listed below:
- Tkinter: It is easiest to start with. Tkinter is Python’s standard GUI (graphical user interface) package. It is the most commonly used toolkit for GUI programming in Python.
- JPython: It is the Python platform for Java that is providing Python scripts seamless access o Java class Libraries for the local machine.
- wxPython: It is an open-source, cross-platform GUI toolkit written in C++. It is one of the alternatives to Tkinter, which is bundled with Python.
Here is the description for above mentioned options:
Tkinter Programming:
Tkinter is the most commonly used library for developing Python GUI Programming. It is a standard Python interface to the Tk GUI toolkit shipped with Python. As Tk and Tkinter are available on most of the Unix platforms as well as on the Windows system, developing GUI applications with Tkinter becomes the fastest and easiest. For modern Tk binding, Tkinter is implemented as a Python wrapper for the Tcl Interpreter embedded within the interpreter of Python.
Creating a GUI application using Tkinter is an easy task. All you need to do is perform the following steps:
- It imports the Tkinter module.
- It creates the GUI application’s main window.
- It adds one or more of the above-mentioned widgets to the GUI application.
- It enters the main event loop to take action against each event triggered by the user.
from tkinter import * appWindow = Tk() appWindow.title("Window Title-Tutorialsart.com") appWindow.mainloop()
Tkinter Widgets:
Tkinter widgets provide various controls, such as buttons, labels, and text boxes used in a Python GUI Programming application. These controls are commonly called widgets. There are 19 widgets in Tkinter. Given below:
Operator | Description |
Button | The Button used to display buttons in your application. |
Checkbutton | The CheckButton used to display a number of options as checkboxes. The user can select multiple options at a time. |
Canvas | The Canvas used to draw shapes, such as lines, ovals, polygons and rectangles, in your application. |
LabelFrame | The labelFrame (a simple container widget) primary purpose is to act as a spacer or container for complex window layouts. |
Spinbox | The Spinbox a variant of the standard Tkinter Entry widget, which can be used to select from a fixed number of values. |
MessageBox | This module is used to display message boxes in your applications. |
Menu | The Menu used to provide various commands to a user. These commands are contained inside the Menu button. |
Toplevel | The Toplevel used to provide a separate window container. |
Scrollbar | The Scrollbar used to add scrolling capability to various widgets, such as list boxes. |
PanedWindow | A PanedWindow is a container widget that may contain any a number of panes arranged horizontally or vertically. |
Message | The Message used to display multiline text fields for accepting values from a user. |
Scale | The Scale used to provide a slider widget. |
Menubutton | The Menu button used to display menus in your application. |
Radiobutton | The Radiobutton used to display a number of options as radio buttons. The user can select only one option at a time. |
Label | The Label used to provide a single-line caption for other widgets. It can also contain images. |
Entry | The Entry used to display a single-line text field for accepting values from a user. |
Listbox | The Listbox used to provide a list of options to a user. |
Frame | The Frame used as a container widget to organize other widgets. |
Comments are closed.