Dev Prakash Sharma has Published 556 Articles

Placing plot on Tkinter main window in Python

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 11:39:14

2K+ Views

Oftentimes, we need to deal with plots in our Tkinter GUI-based application. To support the plots for the available data points, Python provides a Matplotlib package that can be imported into the application easily. In order to add a plot for the given data points, we have to install several ... Read More

How to show a window that was hidden using the "withdraw" method in Tkinter?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 11:26:04

6K+ Views

Tkinter withdraw method hides the window without destroying it internally. It is similar to the iconify method that turns a window into a small icon. Let us suppose we want to reveal the hidden window during the execution of an application then we can use deiconify() method. It can be invoked with the ... Read More

How to draw images in the Tkinter window?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 11:05:45

953 Views

To process images with Tkinter and other Python packages, we generally refer to use Pillow Package or PIL in Python. It provides a way to load and process the images in the program wherever we need. Initially, we convert the image to an instance of PhotoImage object that allows images ... Read More

How to disable checkbutton Tkinter (grey out)?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 11:01:19

3K+ Views

The state property in Tkinter is used to change the state of any specific widget. We can make a widget either active or disabled whenever required. To disable the Checkbuttons widget, we have to set the state property as readonly or disabled. Changing the state will make all the checkbuttons inactive ... Read More

How to create Tkinter buttons in a Python for loop?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 09:35:35

3K+ Views

Tkinter Button widgets are very useful in terms of handling events and performing actions during the execution of an application. We can create Tkinter Buttons using the Button(parent, text, option..) constructor. Using the constructor, we can create multiple buttons within the loop.ExampleIn this example, we will create multiple buttons in ... Read More

How to stop Tkinter after function?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 09:17:24

4K+ Views

Tkinter functions can be created with the help of threading concept where we define, when a function should run or stop. A Tkinter function can be scheduled using the after(time, callback) function.Let us suppose that we have created a callback function that forces the main window to be closed after ... Read More

How to set the width of a Tkinter Entry widget in pixels?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 09:15:13

10K+ Views

Tkinter has an Entry widget to accept single-line user input. It has many properties and attributes that can be used to configure the Entry widget. To change the size (width or height of the Entry widget), we can use Internal Padding Properties – ipadx and ipady. By defining the value of ... Read More

How to remove focus from a Tkinter widget?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 09:13:01

2K+ Views

To active the focus on a particular widget during the execution of a Tkinter program, we can use focus_set() method. Adding the focus creates a gray line around the widget and makes it visible to the user.There might be some cases when we need to remove the focus from the ... Read More

How do I make a pop-up in Tkinter when a button is clicked?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 09:11:08

2K+ Views

Popup window in Tkinter can be created by defining the Toplevel(win) window. A Toplevel window manages to create a child window along with the parent window. It always opens above all the other windows defined in any application. We can create a top-level window or a child window by initializing ... Read More

How do I find out the size of a canvas item in Tkinter?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 09:07:44

2K+ Views

To find the minimum height and width of canvas items, we can use the bounding box property of Canvas. Basically, a bounding box property enables the canvas item to return the position inside the canvas. Initially, every item in the bbox(item) method defines the minimum and maximum width and height ... Read More

Advertisements