Dev Prakash Sharma has Published 548 Articles

How can I put two buttons next to each other in Tkinter?

Dev Prakash Sharma

Dev Prakash Sharma

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

7K+ Views

Tkinter generally provides three general ways to define the geometry of the widgets. They are − Place, Pack, and Grid Management. If we use the Pack geometry manager, then place the two buttons in the frame using side property. It places the buttons horizontally stacked in the window in (Left, Right, ... Read More

How can I insert a string in an Entry widget that is in the "readonly" state using Tkinter?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 08:58:54

856 Views

Tkinter Entry widget is used to insert single-line text input. We can use the Entry widget to create forms where single-line input is the prime requirement.Sometimes, we need to insert a predefined text inside the Entry Widget. In such cases, we can use insert(INSERT, ) method. These are generally called ... Read More

Default to and select the first item in Tkinter Listbox

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 08:50:24

4K+ Views

Tkinter Listbox widgets are used to display a scrollable list of items with vertically stacked menus. Sometimes, we may need to set the list item selected, by default. We can use the select_set(list_item_index) method by specifying the index of the list items that need to be selected by default.So, let ... Read More

Create multiple buttons with "different" command function in Tkinter

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 08:46:56

8K+ Views

A Button can be initialized using the for loop in a Tkinter application. Let us suppose that we want to create multiple buttons, each with different commands or operations defined in it. We have to first initialize the Button inside a for loop. The iterator will return the object for which multiple ... Read More

Converting Tkinter program to exe file

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 08:44:24

22K+ Views

Let us suppose that we want to create a standalone app (executable application) using tkinter. We can convert any tkinter application to an exe compatible file format using the PyInstaller package in Python.To work with pyinstaller, first install the package in the environment by using the following command, pip install pyinstallerOnce ... Read More

Change the color upon hovering over Button in Tkinter

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 03-May-2021 08:40:58

5K+ Views

Let us suppose that we are creating an application in which we want to change the color of the Button widget while we hover upon it. We can have the hovering property by defining the Event Callbacks.To change the color of the Button while hovering on it, we have to ... Read More

Binding mouse double click in Tkinter

Dev Prakash Sharma

Dev Prakash Sharma

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

3K+ Views

Let us suppose that for a particular application, we want to bind the mouse double-click so that it performs some event or operation. We can use the bind(‘’, handler) or bind(‘’, handler) methods to bind the mouse Left or Right Buttons with a handler or a callback function.ExampleIn this example, ... Read More

Automatically close window after a certain time in Tkinter

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 30-Apr-2021 21:26:25

7K+ Views

In order to close a Tkinter application, we generally refer to close the parent window using the destroy() method. To close the Tkinter window automatically after a certain time limit, we have to use the after(time in ms, callback) method by specifying the time and the callback function which needs ... Read More

Why do we use import * and then ttk in TKinter?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 22-Apr-2021 07:55:09

5K+ Views

In order to work with a tkinter application, we have to install and import the tkinter library in our environment. Generally, we import the tkinter library in the environment by using from tkinter import * command.The significance of "import *" represents all the functions and built-in modules in the tkinter ... Read More

What does calling Tk() actually do?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 22-Apr-2021 07:54:49

9K+ Views

Tkinter is a Python package which comes with many functions and methods that can be used to create an application. In order to create a tkinter application, we generally create an instance of tkinter frame, i.e., Tk(). It helps to display the root window and manages all the other components ... Read More

Advertisements