- 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)
3K+ Views
Let us suppose we want to change the border color of a tkinter widget. We can configure the widget by passing the highlightcolor, highlightbackground property of the widget.ExampleIn this example, we have created an Entry widget and a button that can be triggered to change the border color of the Entry Widget.#Import the required libraries from tkinter import * #Create an instance of tkinter frame win= Tk() #Set the geometry of frame win.geometry("600x250") #Define a function to change the color of entry widget def change_color(): text.config(highlightthickness=2, highlightbackground="red") #Create a Entry widget for which we want ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
7K+ Views
Tkinter Entry widget is used to display a single line text. Using tkinter Entry widget, we can set its value or content by triggering a button. It has mainly two types of operation: insert and delete.Using the Tkinter Button widget, we will set the content of the Entry widget.Example#Import the required libraries from tkinter import * #Create an instance of tkinter frame win= Tk() #Define a function to change the value def change_text(txt): text.delete(0, END) text.insert(0, txt) #Set the geometry of frame win.geometry("600x250") #Create an Entry Widget text= Entry(win) text.pack() #Create a button ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
7K+ Views
Tkinter creates a default window with its default size while initializing the application. We can customize the geometry of the window using the geometry method.However, in order to maximize the window, we can use the state() method which can be used for scaling the tkinter window. It maximizes the window after passing the “zoomed” state value to it.Example#Import the required libraries from tkinter import * #Create an instance of tkinter frame win= Tk() #Set the geometry of frame win.geometry("600x400") #Create a text label Label(win, text="It takes only 21 days to create a new Habit", font=('Times New Roman ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
3K+ Views
In order to change the default behavior of tkinter widgets, we generally override the option_add() method. The properties and values passed to option_add() method will reflect the changes in all the widgets in the application. Thus, changing the default font will affect the font for all the widgets defined in the application.ExampleHere we will pass two parameters into the option_add() method, i.e., option_add("*font", "font-family font-size font-style font-orientation").#Import the required libraries from tkinter import * #Create an instance of tkinter frame win= Tk() #Set the geometry of frame win.geometry("600x400") #Change the default Font that will affect in all ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
2K+ Views
We can customize the tkinter widgets using the tkinter.ttk module. Tkinter.ttk module is used for styling the tkinter widgets such as setting the background color, foreground color, activating the buttons, adding images to labels, justifying the height and width of widgets, etc.In order to add a background color in tkinter widgets, we can specify the background property in the widget.ExampleIn the following example, we will create a button that will change the background of the text label.#Import the tkinter library from tkinter import * from tkinter.ttk import * #Create an instance of tkinter frame win = Tk() #Set the ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
4K+ Views
When we invoke the destroy() method with the tkinter window object, it terminates the mainloop process and destroys all the widgets inside the window. Tkinter destroy() method is mainly used to kill and terminate the interpreter running in the background.However, quit() method can be invoked in order to stop the process after the mainloop() function. We can demonstrate the functionalities of both methods by creating a button Object.Example#Import the required libraries from tkinter import * #Create an instance of tkinter frame win= Tk() #Set the geometry of frame win.geometry("650x450") #Define a function for Button Object def quit_win(): ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
6K+ Views
tkinter.ttk is a module that is used to style the tkinter widgets. Just like CSS is used to style an HTML element, we use tkinter.ttk to style tkinter widgets.Here are the major differences between tkinter widget and tkinter.ttk −Tkinter widgets are used to add Buttons, Labels, Text, ScrollBar, etc., however, tkinter.ttk supports a variety of widgets as compared to tkinter widgets.Tkinter.ttk doesn't support Place, Pack() and Grid(), thus it is recommended to use tkinter widget with ttk.Ttk has many features and configurations that extend the functionality of a native application and make it look more modern.Tkinter widget is a native ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
2K+ Views
In this article, we will create a GUI-based dictionary using PyDictionary and Tkinter Module.PyDictionary is a Python Module that helps to get meaning translations, antonyms and synonyms of words. It uses WordNet for getting meanings, Google for translations, and synonym.com for getting synonyms and antonyms. PyDictionary uses BeautifulSoup, Requests module as the dependencies.In order to create the application, we will first install these modules in our environment using pip install PyDictionaryAfter installing, we will create a tkinter frame and some other element.Example# Import Required Librares from tkinter import * from PyDictionary import PyDictionary # Create instances and objests dictionary ... Read More
![Dev Prakash Sharma](https://www.tutorialspoint.com/assets/profiles/302800/profile/60_4750-1612521296.jpg)
286 Views
In this article, we will create a GUI-based window resizer control panel that will have a pane to resize the window by its height or width.In order to create the application, we will first create a slider that will help to resize the window size. The sliders are available in the ttk library of tkinter. We will import “ttk” first. Then, we will launch a new window which needs to be resized.Let us first import all the required libraries in the notebook and design the control bars using sliders.Example# Import the required Libraries from tkinter import * from tkinter import ... Read More