Kiran Kumar Panigrahi has Published 61 Answers

Tkinter - How to put an outline on a canvas text

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 13:07:32

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. So, to put an outline on a canvas text, you can follow the steps given below −Steps −Import the required libraries and create an instance of ... Read More

How to draw an arc on a tkinter canvas?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 12:58:44

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 of the Canvas and supply it with a set of coordinates to ... Read More

How to get rid of widget border in Tkinter?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 12:55:08

Tkinter comes with different types of widgets such as Button, Entry, Frame, Label, Radiobutton, Scrollbar, etc. Widgets are standard graphical user interface (GUI) elements that display information or help users interact with the system.In this example, we will see how to get rid of the border from a canvas, Entry ... Read More

Embedding an Image in a Tkinter Canvas widget using PIL

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 12:51:09

The Pillow library in Python contains all the basic image processing functionality. It is an open-source library available in Python that adds support to load, process, and manipulate the images of different formats.Let's take a simple example and see how to embed an Image in a Tkinter canvas using Pillow ... Read More

How to run an infinite loop in Tkinter?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 12:48:38

To run an infinite loop in Tkinter, we will use the after method to call a method recursively after a specified time period until the user decides to stop the loop. Let's take a simple example and see how to start and stop an infinite loop.Steps −Import the required libraries ... Read More

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

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 12:45:08

To place objects in the middle of a frame, we can use the place method. Let's take an example and see how it's done.Steps −Import the required libraries and create an instance of tkinter frame.Set the size of the frame using win.geometry method.Next, create a button and label it.Set the ... Read More

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

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 12:40:58

To place objects in the middle of a frame, we can use the place method. Let's take an example and see how it's done.Steps −Import the required libraries and create an instance of tkinter frame.Set the size of the frame using win.geometry method.Next, create a button and label it.Set the ... Read More

How do I position the buttons on a Tkinter window?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 12:38:26

To set the position of a button, we use the place method of button widget. The place method takes the x and y coordinates of the button.Steps −Import the required libraries and create an instance of tkinter frame.Set the size of the frame using win.geometry method.Next, create multiple buttons and ... 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-Oct-2021 12:35:43

To bind a Tkinter event to the left mouse button being held down, we can take the following steps −Create an instance of tkinter frame.Set the size of the frame using win.geometry method.Define an event handler "handler1" to print a statement when the mouse is moved with the left button ... Read More

How to save the contents of a Textbox in Tkinter?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 12:32:06

To save the contents of a Textbox in Tkinter, we can take the following steps −Create an instance of tkinter frame.Set the size of the frame using win.geometry method.Define a user-defined method "open_text" to open a text file in "read" mode. Read the contents of the text file and save ... Read More

Advertisements