Dev Prakash Sharma has Published 556 Articles

How to stop Tkinter Frame from shrinking to fit its contents?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 04-May-2021 14:20:20

10K+ Views

The sizing property of all the widgets in the Tkinter frame is by default set to the size of the widgets themselves. The frame container shrinks or grows automatically to fit the widgets inside it. To stop allowing the frame to shrink or grow the widget, we can use propagate(boolean) ... Read More

How to Update the label of the Tkinter menubar item?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 04-May-2021 14:19:52

859 Views

A Menubar contains a set of Menu Item in which each Menu Item is defined for different functionalities or operations. Let us suppose that we want to update the label of Menu Bar Items, then we can use entryconfigure(item_number, options..) method in a callback. To update the Menu Items in the ... Read More

How would I make destroy() method in Tkinter work with my code?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 04-May-2021 14:19:28

520 Views

In order to close or remove any widget in an existing Tkinter application, we can use the destroy() method. It terminates the widget process abruptly within the program. The method can be invoked with the specific widget we want to close.ExampleIn this example, we will create a button to remove the Label ... Read More

Is it possible to color a specific item in a Tkinter Listbox widget?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 04-May-2021 14:19:01

2K+ Views

Tkinter ListBox widget is generally used for creating a list of items in the form of a list. The items can be chosen through the mouse buttons whenever we click a particular List Item. Each item in the ListBox is configured with the default color, which can be changed by ... Read More

Making Menu options with Checkbutton in Tkinter?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 04-May-2021 14:18:37

2K+ Views

The Menu Bar in Tkinter can be created by initializing Menu (parent) instances in the application. We can add checkbuttons in place of add_command to extend the feature of Menu Bar in any application.To add the menu items using the add_checkbutton(label, options) method, we first initialize a Menu Bar. Once ... Read More

How to control automated window resizing in Tkinter?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 04-May-2021 14:17:33

4K+ Views

The Tkinter window can be resized manually by defining the geometry ("width × height") method. We can automate or reset the window to its original form by passing an empty value to the geometry manager. Once the empty value is passed to the method, it will get resized automatically. In ... Read More

What is the difference between a variable and StringVar() of Tkinter?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 04-May-2021 14:17:08

703 Views

A variable in Tkinter is used to store the values of any data. For a Tkinter application, we can store the values in two ways −by defining the value programmatically, orby storing the value through user Input.A normal variable can be used to set the value for any application whenever ... Read More

Tkinter button commands with lambda in Python

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 11:50:48

25K+ Views

Lamda Functions (also referred to as Anonymous Function in Python) are very useful in building Tkinter GUI applications. They allow us to send multiple data through the callback function. Lambda can be inside any function that works as an anonymous function for expressions. In Button Command, lambda is used to ... Read More

Set style for Labelframe in Python Tkinter

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 11:46:40

2K+ Views

Tkinter LabelFrame is similar to Frames in Tkinter Library. It works like a container where widgets can be placed. LabelFrame initially creates a container with some rectangular border around it. In order to style the LabelFrame widget, we have several style options such as background, borderwidth, labelanchor, highlightcolor and many ... Read More

Rock Paper and Scissor Game Using Tkinter

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 11:44:59

3K+ Views

Tkinter is one of the Python-based libraries used to create and develop Desktop User interfaces and applications. Using the Tkinter library and its packages, we will create a Rock Paper Scissor Game Application. The game can be played between two people using hand gestures. The condition for winning the game ... Read More

Advertisements