- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 604 Articles for Tkinter
7K+ Views
Python libraries are independent and thus they all can be used for different purposes while building a particular featured application. In this example, we will build an application using OpenCV and Tkinter library. OpenCV is a Python library that is used to work with Computer Vision and other artificial artifacts. Using the OpenCV module, we have to show the webcam in a tkinter window.To create the application, you are required to install open-cv in your local machine and make sure that Python Pillow package is pre-installed. You can install these packages by typing the following commands, pip install open-cv pip ... Read More
1K+ Views
The Canvas widget is one of the multilateral widgets in tkinter library which is used to provide graphics for any application. It can be used to draw shapes, images, animating objects or any complex visuals. The alpha property of the shape defines that if we give the alpha value to any shape, then it must have some transparency behaviour with respect to its parent window.To define the alpha property, we have to assume that every shape have some colors in it and whenever we provide an alpha value to a shape, then it must be converted into an Image. The ... Read More
31K+ Views
Sometimes, handling events in a Tkinter application can become a daunting task for us. We have to manage the action and events which need to be executed at the time of running the application. The Button widget is useful for handling such events. We can use Button widget to perform a certain task or event by passing the callback in the command.While giving the command to the Button widget, we can have an optional lambda or anonymous functions which interpret to ignore any errors in the program. These are just like a general function but they don't have any function ... Read More
2K+ Views
A table contains data items in the form of rows and columns. Consider a case of having a table GUI in an application where we can manipulate the data using other Python libraries such as Numpy, Pandas, Matplotlib, etc. Tkinter provides TreeView widget which enable the user to draw the table and insert the data into it. The TreeView widget can be constructed by defining the Treeview(parent, column, **options) constructor.Example# Import the required libraries from tkinter import * from tkinter import ttk # Create an instance of tkinter frame win = Tk() # Set the size of the ... Read More
1K+ Views
Consider a scenario where we need something to display a menu with some choices in the form of a dropdown list. To achieve this particular feature, Tkinter provides an OptionMenu widget which consists of features to add choices and a list of items in it. We can set up the default behavior of the OptionMenu widget by configuring its property such as background color, width, height, foreground color, etc.Example# Import the required libraries from tkinter import * from PIL import Image, ImageTk # Create an instance of tkinter frame win = Tk() # Set the size of the ... Read More
9K+ Views
The canvas widget is one of the most versatile widgets in Tkinter Library. Generally, it is used to draw shapes, animate objects, and create complex graphics in any application. To create shapes like Rectangle, we use the create_rectangle(x, y, x+ width, y+ height, **options) method. We can configure the item on the canvas by adding properties such as width, height, fill and bg, border width, etc.The alpha property in canvas defines the transparency of the canvas item. However, the property is not available in the Tkinter library; thus, we must define a function to provide the transparency attribute in shape. ... Read More
1K+ Views
The purpose of Tkinter Treeview widget is to provide the user to access the data which can be calculated and modified for the future needs of the application. The Treeview widget is used to populate the given data in a table format. We can add or insert a column, insert data into rows. Sometimes, there might be a case when we want to select multiple rows at a time. This can be done by pressing the Ctrl key and selecting the row from the table.Example# Import the required libraries from tkinter import * from tkinter import ttk # Create ... Read More
2K+ Views
The Tkinter button widget can be used to perform a specific actionable event within the application. We can also invoke the button widget without performing a click operation on it. The invoke() method in Tcl/Tk does the same thing which returns a string in case if there are any commands given to the Button. The invoke() method can be called up after the initialization of the Button widget. The event will be called automatically once the Button widget is prepared.Example# Import the required libraries from tkinter import * from tkinter import ttk from tkinter import messagebox # Create an ... Read More
2K+ Views
Tkinter is a standard Python library that is used to build featured GUI-based desktop applications. Tkinter itself offers a variety of functions and widgets that can be used to design and serve the application's needs.Tkinter Treeview widget is one of the consistent widgets which is used for driving the data and information in the form of a table. It works similar to MS Excel where we can add or define columns, insert some values to it, and perform queries in the backend using other Python libraries (such as Numpy or Pandas).Tkinter Treeview widget is created by defining the Treeview(parent, column=(**col), ... Read More
4K+ Views
Tkinter has many inbuilt functions that power the application logic to make it more functional and maintainable. Tkinter has the wait_window() method which ideally waits for an event to happen and executes the event of the main window. The wait_window() method can be called after the event which needs to happen before the main window event.The wait_window() method is useful in many applications where a particular event needs to be executed first before the main program.ExampleIn this example, we have created a toplevel window, which when gets destroyed, the event in the main window gets executed instantly.# Import the required ... Read More