Kiran Kumar Panigrahi has Published 61 Answers

How to decode JSON into objects in Golang?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 01-Nov-2021 06:30:03

Suppose we have a JSON that looks like this.{ "name":"Mukul Latiyan", "age":10, "sports":[ "football", "tennis", "cricket" ] }Now, we want ... Read More

How to get the longitude and latitude of a city using Python?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 14:48:27

To get the longitude and latitude of a city, we will use the geopy module. geopy uses third-party geocoders and other data sources to locate the coordinates of addresses, cities, countries, etc.First of all, make sure the geopy module is installed −pip install geopyIn the following example, we will use ... Read More

How to insert a temporary text in a tkinter Entry widget?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 14:43:03

To insert a temporary text in a tkinter Entry widget, we will bind the <FocusIn> event with the Entry widget and call a user-defined function to delete the text inside the Entry widget.Steps −Import the tkinter library and create an instance of tkinter frame.Set the size of the frame using ... Read More

How to update a Button widget in Tkinter?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 14:39:35

We can update a Button widget in Tkinter in various ways, for example, we can change its size, change its background color, or remove its border, etc. In the following example, we will create three Button widgets and each of the buttons, upon clicking, will call a different function to ... Read More

How to show the status of CAPS Lock Key in tkinter?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 14:32:34

We can use the <Lock-KeyPress> and <Lock-KeyRelease> bindings to check if the CAPS Lock Key is ON or off. In the following example, we will create two user-defined functions "caps_lock_on()" and "caps_lock_off()" which will capture the event of Lock-KeyPress and Lock-KeyRelease and print the status on the screen.Example# Import required ... Read More

How to call a function using the OptionMenu widget in Tkinter?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 14:28:55

Let's take an example and see how to call a function using OptionMenu widget in Tkinter. In the example, we will use a StringVar object and call its get() method. A StringVar object in Tkinter can help manage the value of a widget.We will create an OptionMenu widget and fill ... Read More

How to use a StringVar object in an Entry widget in Tkinter?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 13:51:25

A StringVar object in Tkinter can help manage the value of a widget such as an Entry widget or a Label widget. You can assign a StringVar object to the textvariable of a widget. For example, data = ['Car', 'Bus', 'Truck', 'Bike', 'Airplane'] var = StringVar(win) my_spinbox = ... Read More

How to set a default string value on a Tkinter Spinbox?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 13:48:55

To set a default string value on a Tkinter Spinbox, we will have to use the set method. Let us take an example and see how to create a spinbox with a set of string values and then set a default string.Steps −Import the tkinter library and create an instance ... Read More

How to draw a line following mouse coordinates with tkinter?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 13:46:39

To draw a line following mouse coordinates, we need to create a function to capture the coordinates of each mouse-click and then draw a line between two consecutive points. Let's take an example and see how it can be done.Steps −Import the tkinter library and create an instance of tkinter ... Read More

How to place the text at the center of an Entry box in Tkinter?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 13:44:13

To put a border around a Frame in Tkinter, we have to use the highlightbackground and highlightthickeness parameters while creating the Frame. Let's take an example and see how to use these two parameters.Steps −Import the tkinter library and create an instance of tkinter frame.Set the size of the frame ... Read More

Advertisements