Articles on Trending Technologies

Technical articles with clear explanations and examples

Window Resizer Control Panel in Tkinter

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

In this article, we will create a GUI-based window resizer control panel using Tkinter that allows you to resize a target window by adjusting its width and height through sliders. We'll use the ttk library from Tkinter to create the sliders and build a control panel that can launch a new window and dynamically resize it using three different controls: width-only, height-only, and proportional resizing. Creating the Basic Control Panel Let's start by creating the main window with the control interface − # Import the required Libraries from tkinter import * from tkinter import ttk ...

Read More

What does the 'tearoff' attribute do in a Tkinter Menu?

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

The tearoff attribute in Tkinter Menu controls whether a menu can be "torn off" or detached from its parent window. When enabled, users can separate the menu into a floating window for easier access. Tearoff Options The tearoff attribute accepts a Boolean value with two behaviors: tearoff=0 − Menu remains attached to the parent window (default) tearoff=1 − Menu displays a dashed separator line at the top, allowing users to detach it Example: Non-Tearable Menu Here's how to create a menu that stays attached to the window: import tkinter as tk ...

Read More

Tkinter bell() method

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

Tkinter bell() method produces the default system sound or beep. This method can be invoked on any Tkinter widget to trigger the system's default notification sound. You can customize the system sound through your operating system's sound settings. Syntax widget.bell() Where widget can be any Tkinter widget like root window, Frame, Button, etc. Example Let's create a simple application with a button that plays the system bell sound when clicked − # Import the library from tkinter import * # Create an instance of tkinter frame win = Tk() ...

Read More

Ratio Calculator GUI using Tkinter

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

In this article, we will see how to create a functional GUI application that calculates ratios using Python's Tkinter library. We will use the Spinbox widget that creates an ideal spinner for numeric values. The Spinbox allows users to select values within a specified range by either typing directly or using up/down arrows. We'll build a ratio calculator that solves for the fourth term in a proportion: if a:b = c:x, then x = (b×c)/a. Creating the Ratio Calculator Let's create a complete tkinter application with spinboxes for input values and a button to perform the calculation ...

Read More

Python program to find the sum of sine series

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

Let us consider that we have a value x and we need to calculate the sum of the sine(x) series. The sine series is represented mathematically as: sine(x) = x - x³/3! + x⁵/5! - x⁷/7! + x⁹/9! - ... To solve this series-based problem, we will take the degree as input, convert it to radians, and then iterate through the terms to calculate the sum using the mathematical formula. Approach Take input of the number of terms and degree value. Convert degree to radians using the formula: radians = degrees × π/180 ...

Read More

Python program to calculate the number of digits and letters in a string

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

Sometimes we need to count the number of digits and letters in a string separately. Python provides built-in methods like isdigit() and isalpha() to identify character types easily. Example Input and Output Input − s = "tutorialsP0int" Output − Letters: 13 Digits: 1 Explanation − The string contains 13 alphabetic characters and 1 numeric digit. Approach To count letters and digits in a string, we iterate through each character and use Python's built-in string methods: Initialize counters for letters and digits Loop through each character in ...

Read More

On/Off Toggle Button Switch in Tkinter

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

Creating an on/off toggle button in Tkinter is useful for implementing features like dark mode, settings toggles, or any binary state controls. This involves changing button images and associated text when clicked. Basic Toggle Button Structure A toggle button requires three key components: a state variable, images for both states, and a function to switch between them ? import tkinter as tk from tkinter import ttk # Create main window root = tk.Tk() root.title('Toggle Button Demo') root.geometry('400x200') # State variable is_on = True # Toggle function def toggle(): global ...

Read More

How to use Unicode and Special Characters in Tkinter?

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

Sometimes we need to add Unicode and special characters in our Tkinter application. We can add Unicode characters in our labels or widgets by concatenating the signature as u'\u'. You can find the list of all Unicode characters from here. Basic Unicode Character Example In this example, we will add a Unicode character in the button widget ? # Import the required Libraries from tkinter import * # Create an instance of tkinter frame win = Tk() win.geometry("700x200") # Create a button with Unicode character Button(win, text='Click' + u'\u01CF', font=('Poppins bold', 10)).pack(pady=20) # ...

Read More

How to use Thread in Tkinter Python?

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

With Tkinter, we can call multiple functions simultaneously using Threading. Threading provides asynchronous execution of functions in an application, preventing the GUI from freezing during long-running operations. To use threading in Python, we import the threading module. The Thread() function allows us to execute functions in separate threads, keeping the main GUI thread responsive. Basic Threading Example Let's create a thread that sleeps for 5 seconds while keeping the GUI responsive ? import tkinter as tk import time import threading # Create the main window win = tk.Tk() win.geometry("400x200") win.title("Threading Example") # Create ...

Read More

How to speed up scrolling responsiveness when displaying lots of text in Tkinter?

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

When displaying large amounts of text in Tkinter, scrolling can become sluggish and unresponsive. This happens because Tkinter tries to render all content at once, which can overwhelm the interface when dealing with files containing thousands of lines. To improve scrolling responsiveness with large text files, we can use a Scrollbar widget combined with a Listbox or Text widget. The scrollbar allows users to navigate through content efficiently without loading everything into memory simultaneously. Basic Implementation with Listbox Here's how to create a responsive scrollable text display using a Listbox with a vertical scrollbar: import ...

Read More
Showing 1–10 of 61,304 articles
« Prev 1 2 3 4 5 6131 Next »
Advertisements