Found 26504 Articles for Server Side Programming

How to read the pixel value from the multichannel image in OpenCV using C++?

Ginni
Updated on 03-May-2021 10:27:28

829 Views

We have declared three variables named-'blue_Channel', 'green_channel' and 'red_channel'. The goals of these variables is to save the pixel values. We have used these variables inside the 'for loops'. Then we declared a matrix named 'color_Image_Matrix'.The syntax of this method is:blue_Channel = color_image_Matrix.at(i, j)[0];We used a BGR image. It has three channels. These channels maintain specific sequence, color_image_Matrix.at (i, j) represents the pixel values located at (i, i) and [0] represents the first channel. For example, if we write the line as follows:blue_Channel=color_image_Matrix.at (30, 35) [0];It means the variable 'blue_Channel' will have the first channel's pixel value located at(30, 35). ... Read More

How to disable a Combobox in Tkinter?

Dev Prakash Sharma
Updated on 04-May-2021 14:25:48

4K+ Views

The Combobox widget is similar to the OptionMenu widget in Tkinter which gives the user a choice to select from the group of options. The Combobox widget allows users to select the option with an Entry widget that adds selected menu items from the dropdown list.We can Enable or Disable the options in the given Combobox widget by providing the state property. The state property forces to make a widget either active or disabled. To disable the Combobox widget, we have to set the state property as readonly or disabled.Example#Import the required Libraries from tkinter import * from tkinter import ttk ... Read More

How to create Tkinter buttons in a Python for loop?

Dev Prakash Sharma
Updated on 03-May-2021 09:35:35

3K+ Views

Tkinter Button widgets are very useful in terms of handling events and performing actions during the execution of an application. We can create Tkinter Buttons using the Button(parent, text, option..) constructor. Using the constructor, we can create multiple buttons within the loop.ExampleIn this example, we will create multiple buttons in the range using a Python for loop.#import required libraries from tkinter import * from tkinter import ttk #Create an instance of Tkinter frame win= Tk() #Set the geometry of the window win.geometry("750x250") #Create a LabelFrame labelframe= LabelFrame(win) #Define a canvas in the window canvas= Canvas(labelframe) canvas.pack(side=RIGHT, fill=BOTH, ... Read More

How to create a message box with Tkinter?

Dev Prakash Sharma
Updated on 04-May-2021 14:26:28

3K+ Views

In a particular application, we can create messagebox using messagebox method. Here is the list of messagebox we can create for a particular application, showinfo() - to show a general message on the screen.showwarning() - to show the warning to the user.showerror() - Display error message.askquestion() - Query the user through the messagebox.asktocancel() - Display the info to cancel an operation.askretrycancel() - Display the message to prompt the user to retry again or not.ExampleIn this example, we will create an application that will show an info message box after clicking a button.#Import required libraries from tkinter import * from tkinter ... Read More

How to connect a progress bar to a function in Tkinter?

Dev Prakash Sharma
Updated on 04-May-2021 14:26:46

3K+ Views

A Progress Bar helps to visualize the state of a running process. We have used and interacted with many progress bars such as getting the status of downloading a file from the internet, Loading a file on the local system, etc.Let us suppose that we want to create and connect a progress bar in our application. We will create a full-width progress bar by using ProgressBar(win, options) method. It can be configured through a button that enables and disables it.Example#Import the required Libraries from tkinter import * from tkinter import ttk import time #Create an instance of tkinter frame ... Read More

How to change the title bar in Tkinter?

Dev Prakash Sharma
Updated on 04-May-2021 14:27:13

22K+ Views

Tkinter initially sets a default title bar for every application. We can update or replace the Title Bar of the Tkinter application by configuring the title("Enter any Title") method. For a particular application, let us see how we can change the title of a Tkinter application that calculates the square of a number.Example#Import the required Libraries from tkinter import * from tkinter import ttk import math #Create an instance of Tkinter frame win = Tk() #Set the geometry of tkinter frame win.geometry("750x270") #Set the Title of Tkinter window win.title("Square Calculator") def find_square():    no= int(entry.get())   ... Read More

How to change the color of a Tkinter label programmatically?

Dev Prakash Sharma
Updated on 04-May-2021 14:27:43

17K+ Views

Tkinter Label widgets are used to add text or images to the application. We can even configure the basic properties of labels using the config(options) method. Generally, in order to configure the widgets property dynamically, we use callback functions where we modify the value of attributes.ExampleIn this example, we will modify the color Tkinter Labels by defining the callback function. The function can be activated by a button that forces the labels to change the color.#Import required libraries from tkinter import * from tkinter import ttk #Create an instance of tkinter frame win= Tk() #Define the geometry of ... Read More

How to change font size in ttk.Button?

Dev Prakash Sharma
Updated on 04-May-2021 14:28:22

5K+ Views

Tkinter Ttk is a native library in Tkinter which is used to style the widgets in a Tkinter application. It provides a native GUI interface to all the widgets defined in the application.In order to style the widgets with ttk, we have to import it in the notebook using the command ‘from tkinter import ttk’.For a particular application, we can change the font properties such as background color, foreground color, font size, font-family, and font style by defining an instance of ttk style object. After initializing the ttk object, we can configure(options) each widget defined in an application.ExampleIn this example, ... Read More

How to bind the spacebar key to a certain method in Tkinter?

Dev Prakash Sharma
Updated on 04-May-2021 14:45:24

2K+ Views

Tkinter methods can be bound with the Keys or Mouse to perform certain operations or events in an application. Let us suppose for a particular application, we want to bind the Key such that it will perform a certain operation. We can bind any key to a particular operation or event by defining the bind(, callback) method.ExampleIn this example, we will create rectangles of random width and height by using random Module in Python. So, whenever we will press the Key, it will generate some random shapes on the screen.#Import the required Libraries from tkinter import * import random ... Read More

How to stop Tkinter after function?

Dev Prakash Sharma
Updated on 03-May-2021 09:17:24

6K+ Views

Tkinter functions can be created with the help of threading concept where we define, when a function should run or stop. A Tkinter function can be scheduled using the after(time, callback) function.Let us suppose that we have created a callback function that forces the main window to be closed after some time. There might be times when we need to stop the scheduling of the function. In order to cancel or stop a particular schedule of a callback function, we can use after_cancel(widget) function.ExampleIn the given example, the script will close the main window after 3 seconds but after initializing ... Read More

Advertisements