Dev Prakash Sharma has Published 548 Articles

How to center a window on the screen in Tkinter?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 26-Mar-2021 11:18:04

22K+ Views

In order to place a tkinter window at the center of the screen, we can use the PlaceWindow method in which we can pass the toplevel window as an argument and add it into the center.We can also set the window to its center programmatically by defining its geometry.Example#Import the ... Read More

How to change a Tkinter widget's font style without knowing the widget's font family/size?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 26-Mar-2021 11:16:41

346 Views

Tkinter’s widgets support properties and attributes such as font-family and font size which can be specified using the font(‘Font-Family’, font-size) property.ExampleIn the following example, we have created a text label that can be configured by defining the font-family as “Times New Roman” and the font-size as “20”.#Import the tkinter library ... Read More

How to change the color of certain words in a Tkinter text widget?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 26-Mar-2021 11:16:15

11K+ Views

Tkinter text widgets are used to create and display multiline text Input. It provides several functions and methods that are generally used to configure a text widget.Let us suppose we want to change the color of certain words in a text widget, then we can use the tag_add(tag name, range) ... Read More

How to change Tkinter Button state from disabled to normal?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 26-Mar-2021 11:15:51

1K+ Views

Tkinter provides Button widgets to create a button for triggering an event. Let us suppose we have created a button that is already disabled in an application. In order to change the state of the button, we can use the state property.The state property is used to enable and disable ... Read More

How to clear an entire Treeview with Tkinter?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 26-Mar-2021 11:11:06

6K+ Views

Tkinter Treeview widgets are used to display the hierarchy of the items in the form of a list. It generally looks like the file explorer in Windows or Mac OS.Let us suppose we have created a list of items using treeview widget and we want to clear the entire treeview, ... Read More

How to clear out a frame in the Tkinter?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 26-Mar-2021 11:09:19

24K+ Views

Tkinter frames are used to group and organize too many widgets in an aesthetic way. A frame component can contain Button widgets, Entry Widgets, Labels, ScrollBars, and other widgets.If we want to clear the frame content or delete all the widgets inside the frame, we can use the destroy() method. ... Read More

How to clear the contents of a Tkinter Text widget?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 26-Mar-2021 11:08:12

23K+ Views

Tkinter Text Widget is used to add the text writer in an application. It has many attributes and properties which are used to extend the functionality of a text editor. In order to delete the input content, we can use the delete("start", "end") method.Example#Import the tkinter library from tkinter import ... Read More

How to clear Tkinter Canvas?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 26-Mar-2021 11:05:41

25K+ Views

Tkinter provides a way to add a canvas in a window and when we create a canvas, it wraps up some storage inside the memory. While creating a canvas in tkinter, it will effectively eat some memory which needs to be cleared or deleted.In order to clear a canvas, we ... Read More

How to close a Tkinter window by pressing a Button?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 26-Mar-2021 11:01:23

2K+ Views

Tkinter initially creates a window or frame that contains widgets and Labels within it. Let us suppose we want to close the tkinter window with a button. A Button is a UI widget that can be used to perform a certain operation.ExampleHere, we will create a button that closes the ... Read More

How to create a download progress bar in Tkinter?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 26-Mar-2021 11:00:08

2K+ Views

Let’s suppose that we are creating an application which interacts with sources and files such as downloading the files, tracking the file. In order to make a progressbar for such an application, we will use the tkinter.ttk package that includes the Progressbar module.Initially, we will instantiate an object of Progressbar ... Read More

Advertisements