GUI-Programming Articles

Page 17 of 25

List of All Tkinter Events

Dev Prakash Sharma
Dev Prakash Sharma
Updated on 25-Mar-2026 15K+ Views

Tkinter is a Python library used to create GUI applications. It provides various events that serve as a bridge between user interactions and application logic, making applications interactive and functional. Here is a comprehensive list of common Tkinter events used to handle user interactions ? Mouse Events − Triggered when any mouse button is pressed. Use for left, for middle, for right click. − Triggered when a mouse button is released after being pressed. − Tracks mouse pointer movement within a widget area. − Triggered when mouse pointer enters ...

Read More

How to create a combo box with auto-completion in Tkinter?

Dev Prakash Sharma
Dev Prakash Sharma
Updated on 25-Mar-2026 3K+ Views

Tkinter Combobox widget is one of the useful widgets to implement dropdown menus in an application. It uses the combination of the Entry widget and ListBox widget on the top of it. We can select menu items by typing the item name (if it exists in the Menu List) in the Entry field. However, sometimes, there might be cases when we need to use autocompletion to select the menu items. In order to create an auto-completion Combobox, we will create a Listbox first to list out the menus and an Entry widget to display the selected Menu. You can ...

Read More

How to center a Tkinter widget in a sticky frame?

Dev Prakash Sharma
Dev Prakash Sharma
Updated on 25-Mar-2026 7K+ Views

Tkinter has lots of inbuilt functions and methods that can be used to configure the properties of Tkinter widgets. These properties vary with different geometry managers. The Grid geometry manager is one of them which deals with many complex layout problems in any application. Grid geometry manager adds all the widgets in the given space without overlapping each other. Let us suppose that we have created a sticky frame using Grid geometry manager and we want to center the Label text widget inside the frame. In this case, we have to first make the main window sticky by configuring ...

Read More

How to add a margin to a tkinter window?

Dev Prakash Sharma
Dev Prakash Sharma
Updated on 25-Mar-2026 8K+ Views

In tkinter, you can add margins to windows and widgets using several approaches. The most common methods involve the pack() geometry manager with padx and pady parameters, or the grid() geometry manager with padding options. Using pack() with Padding The pack() method allows you to add margins using padx (horizontal) and pady (vertical) parameters − # Import the required library from tkinter import * # Create an instance of tkinter frame win = Tk() # Set the size of the Tkinter window win.geometry("700x350") # Add a frame to set the margin of the ...

Read More

How do you create a Tkinter GUI stop button to break an infinite loop?

Dev Prakash Sharma
Dev Prakash Sharma
Updated on 25-Mar-2026 2K+ Views

Tkinter is a Python library used to create GUI-based applications. Sometimes you need to create a loop that continuously updates the interface, like displaying text or processing data. To control such loops, you can use a global variable with Start and Stop buttons. The key is using win.after() instead of a traditional while loop, which would freeze the GUI. This method schedules function calls without blocking the interface. Example Here's how to create a controllable loop with Start and Stop buttons − # Import the required library from tkinter import * # Create an ...

Read More

Python Tkinter – Set Entry width 100%

Dev Prakash Sharma
Dev Prakash Sharma
Updated on 25-Mar-2026 3K+ Views

Tkinter Entry widgets accept single-line user input in a text field. We can change the properties of the Entry widget by providing the default attributes and values in its constructor. When creating GUI applications, you often need Entry widgets that span the full width of the container. The Pack geometry manager provides several ways to achieve this using the fill parameter. Using fill='x' Parameter The simplest way to create a full-width Entry widget is using the fill='x' parameter with the pack method ? # Import the required library from tkinter import * from tkinter import ...

Read More

How to create hyperlink in a Tkinter Text widget?

Dev Prakash Sharma
Dev Prakash Sharma
Updated on 25-Mar-2026 5K+ Views

Tkinter Text widgets are generally used for accepting multiline user input in the given text field. For a particular text document, the content may contain hyperlinks too which is useful in case we want to redirect the user. You can create hyperlinks within the text widget by using HyperLinkManager snippet in Python. The HyperLinkManager code snippet adds the hyperlink on the keyword within the text widget and handles click events to open URLs in the default web browser. HyperlinkManager Class First, we need to create the HyperlinkManager class that handles hyperlink functionality ? import tkinter ...

Read More

Using OpenCV with Tkinter

Dev Prakash Sharma
Dev Prakash Sharma
Updated on 25-Mar-2026 8K+ Views

OpenCV is a Python library used for computer vision and image processing tasks. Combined with Tkinter, you can create interactive GUI applications that capture and display video frames from your webcam in real-time. Installation Requirements Before creating the application, install the required packages − pip install opencv-python pip install Pillow How It Works The application uses OpenCV to capture video frames from your webcam. Each frame is converted using PIL (Pillow) into a format that Tkinter can display. The frames are continuously updated in a Label widget to create a live video feed. ...

Read More

What is a better Tkinter geometry manager than .grid()?

Dev Prakash Sharma
Dev Prakash Sharma
Updated on 25-Mar-2026 491 Views

The Geometry Manager is one of the specific features in the Tkinter library that provides structure to all Tkinter widgets in the window. It controls the formatting, layout and positioning of widgets in a Tkinter application. Tkinter offers three geometry managers, each with unique strengths ? Pack Geometry Manager − Simple linear arrangement Grid Geometry Manager − Table-like rows and columns Place Geometry Manager − Absolute positioning Pack Geometry Manager The pack() method is the simplest geometry manager, ideal for basic layouts. It arranges widgets in blocks before placing them in the parent widget. ...

Read More

Inheriting from Frame or not in a Tkinter application

Dev Prakash Sharma
Dev Prakash Sharma
Updated on 25-Mar-2026 1K+ Views

In Object-Oriented Programming, inheritance allows a derived class to acquire properties from a base class. In Tkinter applications, you can inherit from the Frame class to create custom frames with predefined properties like background color, dimensions, and styling. When you inherit from Frame, your custom class automatically gains all Frame capabilities while allowing you to define default properties that will be applied to every instance. Example: Inheriting from Frame Here's how to create a custom frame class by inheriting from Tkinter's Frame ? # Import Tkinter Library from tkinter import * # Create an ...

Read More
Showing 161–170 of 242 articles
« Prev 1 15 16 17 18 19 25 Next »
Advertisements