- 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
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
1K+ Views
Tkinter Text widget is another input widget similar to the Entry widget which accepts multiline user input in a text field. It contains many inbuilt features and functions which helps to configure the default properties of the text widget. However, to add undo/Redo features in the Tkinter text widget, we can use Boolean attributes undo which ensures that the text can be retrieved again.Example# Import the required libraries from tkinter import * from tkinter import ttk # Create an instance of tkinter frame or window win=Tk() # Set the size of the window win.geometry("700x350") # Create a ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
4K+ Views
Python supports PIL or Pillow package which is an open-source library for opening, manipulating, and saving different formats of images in Python projects. We can use it in our Tkinter application to process and display images.The Label widget in Tkinter is used to render text and images in a Tkinter application. To display images with Label widget in a Tkinter application, we can follow these steps, Make sure that Pillow or PIL package is installed in your system.Load the image in a variable using ImageTk.PhotoImage(file=file_location) function.Create a Label widget to assign the image value as the image.Execute the code to ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
1K+ Views
Tkinter windows are executed after initializing the object of the Tkinter frame or window. We can define the size of the Tkinter window or frame using the Geometry manager. It defines the width and height of the initial Tkinter window where we generally place our widgets. To set the position of the Tkinter window while omitting the width and height, we can define the specification in the geometry manager.Example# Import the required Libraries from tkinter import * from tkinter import ttk # Create an instance of tkinter frame win = Tk() # Set the geometry of tkinter frame ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
9K+ Views
Tkinter is a standard Python library that is used to create and develop functional and featured applications. It has a variety of inbuilt functions, modules, and packages that can be used for constructing the logic of the application.The tkFileDialog is an inbuilt module available in the Tkinter library which is useful for interacting with the system files and directories. However, once we select a particular file in the read mode using tkFileDialog, potentially it can be used further to process the information available in the file.If you want to access the absolute path of the file when it gets loaded in ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
12K+ Views
To display a large set of data in a Tkinter application, we can use the Treeview widget. Generally, we represent data through tables that contain a set of rows and columns. We can add the data in the form of a table with the help of the Treeview widget.To configure the column width of the Treeview widget, we can use the width and stretch property. It sets the width of the Treeview widget column with the given value.ExampleIn this example, we have created a table that contains a list of programming languages. The width of columns ‘ID’ and ‘Programming Language’ is set ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
5K+ Views
In order to create buttons in a Tkinter application, we can use the Button widget. Buttons can be used to process the execution of an event in the runtime of an application. We can create a button by defining the Button(parent, text, **options) constructor.Let us suppose we want to create a Browse Button which when clicked, will ask the user to select a file from the system explorer. To create a dialog box for selecting a file, we can use filedialog package in tkinter library. We can import the filedialog in the notebook using the following command, from tkinter import filedialogOnce the package ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
2K+ Views
Tkinter offers Listbox widgets which is very useful in the case of representing a large set of data items in the form of a list. To configure the listbox widget, we can use configure(*options) method to change the properties such as background color, foreground color, and other properties of the listbox widget. The width property is used to define the width of the listbox widget. If we set width=0, then it will get closed to the length of its content in the listbox.Example# Import the required libraries from tkinter import * # Create an instance of tkinter frame or window ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
3K+ Views
Tkinter is a cross-platform tk GUI toolkit based on Python library which is used to create and develop GUI-based applications. Tkinter application can be bundled in an executable or runnable file which enables the application to run without using Python interpreter or IDLE. The need for bundling an application becomes a priority when the user wants to share the application with other people without sharing the piece of code.Python has a variety of modules and extensions that gives access to the user to convert a running application into an executable, portable file. Each file runs on a different platform; thus, ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
4K+ Views
To render widgets in a Tkinter application, we generally use mainloop() function which helps to display the widgets in a window. In many cases, tkinter window displays over the other windows or programs. While switching to other programs or windows, it seems difficult to find and switch back to the Tkinter window again.We can force our tkinter window to stay on Top of other window or programs by creating a function and defining win.lift() method in a loop. In the loop, it will execute win.after(2000, function()) function to ensure that the tkinter window will always stays on top of other windows.Example# Import ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
1K+ Views
Tkinter text widget can be configured by using the configure(**options) function. We can use it to configure the background color, foreground color, wrapping and other properties of the text widget.The wrap properties of the Text widget describe that the cursor changes its position whenever it detects a new line. However, in Tkinter, the text widget can be wrapped by words and characters. In order to make our text widget to stay in one line, we can use wrap=None property.Example# Import the required libraries from tkinter import * import lorem # Create an instance of tkinter frame or window win=Tk() ... Read More