Kiran Kumar Panigrahi has Published 392 Articles

Functions vs Methods in Golang

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 01-Nov-2021 07:08:11

5K+ Views

In this article, we will learn what similarities and differences are there between functions and methods in Golang. We will start with each of them separately, and then we will see an example where both of them will be used.Let's start with functions and see what they are and how ... Read More

Channel synchronization in Golang

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 01-Nov-2021 06:51:24

1K+ Views

We can make use of channels if we want to synchronize goroutines. By synchronizing, we want to make the goroutines work in a defined manner, for example, not starting the next goroutine until the previous one has finished its execution.The channels help in achieving that, as they can be used ... Read More

How to get the Response status code in Golang?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 01-Nov-2021 06:47:20

14K+ Views

Response status codes are the numbers that we get in response that signify what type of response we received from the server when we asked for something from it.There are different status codes that one gets from the response, and these are mainly divided into five categories.Generally, the status codes ... Read More

How to detect the content type of a file in Golang?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 01-Nov-2021 06:39:05

7K+ Views

Consider a case where we want to get the content type of a file in Golang for whatever reasons. In order to do that, we must first know how to open the file and read some of its bytes into a buffer slice which we will then pass to a ... Read More

How to decode JSON into objects in Golang?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

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

1K+ Views

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 insert a temporary text in a tkinter Entry widget?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

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

24K+ Views

To insert a temporary text in a tkinter Entry widget, we will bind the 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

3K+ Views

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

941 Views

We can use the and 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

5K+ Views

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

5K+ Views

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

Advertisements