
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 603 Articles for Tkinter

10K+ 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

9K+ 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

4K+ 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

3K+ 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

5K+ 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

7K+ 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

3K+ 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

401 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

899 Views
Using Tkinter.Menu, we can create menus and submenus. Also, there are some other properties which are used with tkinter menus.Tearoff property makes the menus in the window as tearable. tearoff attribute accepts a Boolean value to separate the menu from the main window or the parent window. With tearoff attribute, we have two options, If tearoff=0, make the menu stick to the Window.If tearoff=1, it display a “----” empty dotted lines on the menus through which we can separate our menu from the window.Example#Importing the tkinter library from tkinter import * win= Tk() win.title("Tearoff Example") win.geometry("600x500") #Define a Function ... Read More