
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

24K+ Views
Tkinter frames are used to group and organize too many widgets in an aesthetic way. A frame component can contain Button widgets, Entry Widgets, Labels, ScrollBars, and other widgets.If we want to clear the frame content or delete all the widgets inside the frame, we can use the destroy() method. This method can be invoked by targeting the children of the frame using winfo_children().Example#Import the required libraries from tkinter import * #Create an instance of tkinter frame win= Tk() #Set the geometry of frame win.geometry("600x250") #Create a frame frame = Frame(win) frame.pack(side="top", expand=True, fill="both") #Create a ... Read More

23K+ Views
Tkinter Text Widget is used to add the text writer in an application. It has many attributes and properties which are used to extend the functionality of a text editor. In order to delete the input content, we can use the delete("start", "end") method.Example#Import the tkinter library from tkinter import * #Create an instance of tkinter frame win = Tk() #Set the geometry win.geometry("600x250") #Define a function to clear the input text def clearToTextInput(): my_text.delete("1.0", "end") #Create a text widget my_text=Text(win, height=10) my_text.pack() #Create a Button btn=Button(win, height=1, width=10, text="Clear", command=clearToTextInput) btn.pack() #Display ... Read More

45K+ Views
Tkinter Entry widgets are used to display a single line text that is generally taken in the form of user Input. We can clear the content of Entry widget by defining a method delete(0, END) which aims to clear all the content in the range. The method can be invoked by defining a function which can be used by creating a Button Object.ExampleIn this example, we have created an entry widget and a button that can be used to clear all the content from the widget.#Import the required libraries from tkinter import * #Create an instance of tkinter frame ... Read More

25K+ Views
Tkinter provides a way to add a canvas in a window and when we create a canvas, it wraps up some storage inside the memory. While creating a canvas in tkinter, it will effectively eat some memory which needs to be cleared or deleted.In order to clear a canvas, we can use the delete() method. By specifying “all”, we can delete and clear all the canvas that are present in a tkinter frame.Example#Import the tkinter library from tkinter import * #Create an instance of tkinter frame win = Tk() #Set the geometry win.geometry("650x250") #Creating a canvas myCanvas =Canvas(win, ... Read More

2K+ Views
Tkinter initially creates a window or frame that contains widgets and Labels within it. Let us suppose we want to close the tkinter window with a button. A Button is a UI widget that can be used to perform a certain operation.ExampleHere, we will create a button that closes the tkinter window. In order to close and terminate the TCL interpreter, we mainly use the destroy() method.#Import the required libraries from tkinter import * #Create an instance of tkinter frame win= Tk() #Set the geometry of frame win.geometry("600x250") #Create a Label Label(win, text="Press the Close Button to ... Read More

2K+ Views
Let’s suppose that we are creating an application which interacts with sources and files such as downloading the files, tracking the file. In order to make a progressbar for such an application, we will use the tkinter.ttk package that includes the Progressbar module.Initially, we will instantiate an object of Progressbar which has orientation of Horizontal. Then, we will define a function to increase the value of the progressbar and keep updating it.ExampleIn the following example, we have created a download progress bar by updating its value.#Import the required libraries from tkinter import * from tkinter.ttk import * import time ... Read More

2K+ Views
Let us suppose that we want to create an Entry widget that supports multiline user input. In order to create a multiline Entry widget, we can use Text() constructor.ExampleHere, in this example, we will create a window that contains a multiline Entry widget.#Import the library from tkinter import * #Create an object of tkinter window or frame win = Tk() #Define the geometry of window win.geometry("650x250") #Create an instance of Text Widget text = Text(win) text.pack() win.mainloop()OutputRunning the above code will display a window with a text widget that supports multiline user Input.

7K+ Views
Let us suppose we want to add an Entry widget which accepts user passwords. Generally, the passwords are displayed using “*” which yields to make the user credentials in an encrypted form.We can create a password field using tkinter Entry widget.ExampleIn this example, we have created an application window that will accept the user password and a button to close the window.#Import the required libraries from tkinter import * #Create an instance of tkinter frame win= Tk() #Set the geometry of frame win.geometry("600x250") def close_win(): win.destroy() #Create a text label Label(win, text="Enter the Password", font=('Helvetica', ... Read More

8K+ Views
Sometimes, we want to remove a widget that is of no use in the application. We can delete widgets from the window or frame using the .destroy method in tkinter. It can be invoked in the widget by defining a function for it.ExampleIn this example, we have created a button that will remove the text label widget from the window.#Import the tkinter library from tkinter import * #Create an instance of tkinter frame win = Tk() #Set the geometry win.geometry("650x450") #Define a function to remove the text from the screen def delete_text(): text.destroy() #Create a ... Read More

15K+ Views
Tkinter displays the application window by its default size. However, we can display a full-screen window by using attributes('fullscreen', True) method. The method is generally used for assigning a tkinter window with properties like transparentcolor, alpha, disabled, fullscreen, toolwindow, and topmost.Example#Import the tkinter library from tkinter import * #Create an instance of tkinter frame win = Tk() #Set the geometry win.geometry("650x250") #Add a text label and add the font property to it label= Label(win, text= "Hello World!", font=('Times New Roman bold', 20)) label.pack(padx=10, pady=10) #Create a fullscreen window win.attributes('-fullscreen', True) win.mainloop()OutputRunning the above code will ... Read More