Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

About


312 Articles Published

Articles by Kiran Kumar Panigrahi

Page 3 of 32

Tkinter - How to put an outline on a canvas text

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 26-Mar-2026 3K+ Views

The create_text method of Canvas widget in Tkinter doesn't have an attribute like "outline" or "border" to set an outline around a text object. However, you can create an outline effect by using the text's bounding box to draw a rectangle around it. Steps Import the required libraries and create an instance of tkinter frame. Set the size of the frame using root.geometry method. Create a Canvas widget and set its height and width. Also, set its background color with background="white". Next, create a text object inside the Canvas using create_text() method. Set the font and color ...

Read More

How to draw an arc on a tkinter canvas?

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 26-Mar-2026 8K+ Views

The Canvas is a rectangular area intended for drawing pictures or other complex layouts. You can place graphics, text, widgets or frames on a Canvas. To draw an arc on a tkinter Canvas, we will use the create_arc() method. This method creates an arc item which can be displayed as a chord, pieslice, or simple arc based on the parameters provided. Syntax canvas.create_arc(x1, y1, x2, y2, **options) Parameters The create_arc() method accepts the following key parameters ? x1, y1, x2, y2 − Coordinates defining the bounding rectangle start − Starting angle ...

Read More

How to get rid of widget border in Tkinter?

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 26-Mar-2026 12K+ Views

Tkinter widgets like Button, Entry, Frame, Label, and Canvas come with default borders that can sometimes interfere with your application's design. You can remove these borders using specific attributes to create cleaner, more customized interfaces. Common Border Attributes Different widgets use different attributes to control borders: borderwidth or bd − Controls the width of the border (set to 0 to remove) highlightthickness − Controls focus highlight border (Canvas, Entry) relief − Controls the border style (flat, raised, sunken, etc.) Example: Removing Borders from Multiple Widgets Here's how to remove borders from Canvas, Entry, ...

Read More

How to run an infinite loop in Tkinter?

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 26-Mar-2026 9K+ Views

To run an infinite loop in Tkinter, we use the after() method to call a function recursively after a specified time period. This approach is non-blocking and allows the GUI to remain responsive while the loop runs. Why Use after() Instead of while Loop? Using a traditional while True loop would freeze the GUI because it blocks the main thread. The after() method schedules function calls without blocking the interface. Example Here's a complete example showing how to create a controllable infinite loop ? import tkinter as tk # Create the main window ...

Read More

How can I determine the position of a Toplevel in Tkinter?

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 26-Mar-2026 2K+ Views

In Tkinter, you can determine the position of a Toplevel window using the winfo_x() and winfo_y() methods. These methods return the x and y coordinates of the window relative to the screen. Methods to Get Toplevel Position Tkinter provides several methods to retrieve window position information: winfo_x() − Returns the x-coordinate of the top-left corner winfo_y() − Returns the y-coordinate of the top-left corner winfo_rootx() − Returns absolute x-coordinate on screen winfo_rooty() − Returns absolute y-coordinate on screen Example Here's how to create a Toplevel window and get its position coordinates ? ...

Read More

How to place objects in the middle of a frame using tkinter?

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 26-Mar-2026 4K+ Views

To place objects in the middle of a frame in tkinter, we can use the place() method with relative positioning. This approach ensures widgets remain centered even when the window is resized. Syntax The basic syntax for centering widgets using place() ? widget.place(relx=0.5, rely=0.5, anchor=CENTER) Parameters relx=0.5 − Places widget at 50% of parent's width rely=0.5 − Places widget at 50% of parent's height anchor=CENTER − Uses widget's center as reference point Example Here's how to center a button in a tkinter window ? # Import the ...

Read More

How to bind a Tkinter event to the left mouse button being held down?

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 26-Mar-2026 4K+ Views

To bind a Tkinter event to the left mouse button being held down, you need to use the event. This event triggers when the mouse moves while the left button is pressed down. Key Events for Mouse Button Handling Here are the essential mouse events for detecting left button interactions ? − Left mouse button is pressed down − Mouse moves while left button is held down − Left mouse button is released Example Here's a complete example that demonstrates binding events to detect when the left mouse button ...

Read More

How to save the contents of a Textbox in Tkinter?

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 26-Mar-2026 8K+ Views

To save the contents of a Textbox in Tkinter, you can create functions that read from and write to text files. This allows users to load existing content and save their changes. Basic Steps Follow these steps to implement text saving functionality − Create an instance of tkinter frame and set window size Define a function to open and read a text file, then insert content into the Textbox Define a function to save the Textbox contents to a text file Create a Text widget with specified dimensions Add buttons to trigger the open and save ...

Read More

How to make a new folder using askdirectory dialog in Tkinter?

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 26-Mar-2026 3K+ Views

To make a new folder using askdirectory dialog in Tkinter, we can use the filedialog.askdirectory() method to select a parent directory and then create a new subdirectory using os.makedirs(). Required Modules We need to import the following modules ? tkinter − For creating the GUI tkinter.filedialog − For the askdirectory dialog os − For creating directories Step-by-Step Process Create a Tkinter window Define a function that opens the directory dialog ...

Read More

Difference between IPv4 and IPv6

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 25-Mar-2026 9K+ Views

IPv4 and IPv6 are internet protocol versions, with IPv6 being an upgraded version of IPv4. There are several differences between the IPv4 and IPv6 protocols, including their functionality, but the most important difference is the quantity of addresses (Address space) that they create. Read through this article to find out more about IPv4 and IPv6 and how they are different from each other. What is Internet Protocol (IP)? The Internet Protocol is a set of rules that allows our computers to communicate via the Internet. IP addresses are basically in charge of directing the data packets to ...

Read More
Showing 21–30 of 312 articles
« Prev 1 2 3 4 5 32 Next »
Advertisements