- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 310 Articles for GUI-Programming
3K+ Views
To open a file dialog in a tkinter application, tkinter provides the tkfiledialog package which creates a dialog box to interact with the external files located on the system. In order to work with filedialog, we have to first import the package using the following command, import tkinter.filedialog as fdTo open the explorer in the window, use asopenfilename(parent, title, **options) function. It will just pull the window and allow the user to select the file from the explorer. Once the file has been opened, we can define a function to print the list of all the selected files.Example# Import the required libraries ... Read More
1K+ Views
Python is a programming language which can be used to create cross-platform applications that are supported in various operating systems such as Microsoft Windows, Mac OS, and Linux.To create a GUI-based application, we can use the Tkinter library. However, Python provides different modules and extensions which convert a program into an executable application.For Windows executables - PyInstaller, py2exeFor Linux executables - FreezeFor Max executables - py2appExampleFor this example, we will first install the PyInstaller module using pip in our Windows operating system. The module can be installed by using the command, pip install pyInstallerUsing this module, we will convert our application into ... Read More
7K+ Views
Python is capable of handling files, objects, and creating different applications. We can use Python's extensions and packages to build and develop fully featured applications.Suppose you want to control the files in your system; then Python provides an OS Module which has system-enabled functionalities to allow you interact with the files in the operating system.Let us see how we can read multiple text files from a folder using the OS module in Python.Import the OS module in your notebook.Define a path where the text files are located in your system.Create a list of files and iterate over to find if ... Read More
2K+ Views
Tkinter canvas widget is used for many different purposes such as adding objects, drawing shapes, images and complex visuals to a graphical interface in an application. We can also configure its style such as background color, foreground color, and other properties using the configure properties or passing attributes.Suppose we want to inherit the background color of the Canvas widget in another widget or in some part of the application. This can be achieved by using my_canvas["background"] property. Further, we can use canvas["background"] to fetch the background color of the canvas widget.Example# Import the required library from tkinter import * from ... Read More
734 Views
In order to work with Tabs and separate your workflow in an application, Tkinter provides a Notebook widget. We can use the Notebook widget to create Tabs in an application. Tabs are useful to isolate one particular frame or event from another.Generally, Notebook widget can be configured and styled using the ttk themed widget. So, to style a Notebook widget, we pass TNotebook and TNotebook.Tab parameters in the configuration. If we click on a particular Tab, there may appear some rectangular dashed line which can be removed.Example# Import the required library from tkinter import * from tkinter import ttk ... Read More
5K+ Views
Tkinter has many inbuilt features and attributes that help the application developer to build a robust and featured application. We can set the attributes such as background color, foreground color, and other properties of a widget using the configure method in Tkinter.To set the background color or foreground color of a widget, we can use both default and RGB color codes. RGB is defined by the 6 digit alphanumeric character containing different digits of R, G, B values. In order to use RGB color codes in tkinter, we have to define it using the format #aab123.Example# Import the required libraries ... Read More
5K+ Views
Tkinter Events are very useful for making an application interactive and functional. It provides a way to interact with the internal functionality of the application and helps them to rise whenever we perform a Click or Keypress event.In order to schedule the events in tkinter, we generally use the bind('Button', callback) method. We can bind any key to perform certain tasks or events in the application. To bind the Esc key such that it will close the application window, we have to pass the Key and a callback event as the parameter in the bind(key, callback) method.Example# Import the required ... Read More
5K+ Views
Dialog Boxes are a very essential component of any application. It is generally used to interact with the user and the application interface. We can create dialog boxes for any tkinter application using the Toplevel window and other widgets. The toplevel window pops up the stuff above all the other windows. Thus, we can add more stuff on the toplevel window for building dialog boxes.ExampleIn this example, we have created a modal dialog which has two parts, Initialization of the Toplevel window.Function Definition for Popup Dialog Event.Adding widgets in the Toplevel window.Function Definition for Dialog options.# Import required libraries from ... Read More
8K+ Views
Generally, Tkinter treeview widget is used to draft or construct tables for the given data points in the input. We can even add items in the treeview widget to maintain a nested list in an application. If we want to remove or clear all the items in a given treeview widget, then we have to first select all the items present in the treeview widget using get_children() method.Once we have selected all the treeview items programmatically, then we can delete the items using delete(item) method. In order to get all the children, we can use the delete() method inside a loop.Example# ... Read More
14K+ Views
Tkinter is a Python library which is used to create and develop GUI-based applications.Let us suppose that we have to create an application such that we can show or hide the widgets.In order to display/show the widget, use pack() geometry managerTo hide any widget from the application, use pack_forget() method.ExampleLet us take this example to understand how to show/hide widgets −# Import the required libraries from tkinter import * from tkinter import ttk # Create an instance of tkinter frame win = Tk() # Set the size of the tkinter window win.geometry("700x350") # Define the style for ... Read More