
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 26504 Articles for Server Side Programming

3K+ Views
Tkinter Text widget is used to accept multiline user Input. It is similar to Entry Widget but the only difference is that Text widget supports multiple line texts. In order to create a Text widget, we have to instantiate a text object.Adding multiple texts will require to add the ScrollBar. In order to add a scrollbar in the text widget, we can call the ScrolledText(root) function. This function generally creates a text field with a scrollbar.The ScrolledText(root) function resides in Tkinter ScrolledText Module. We can import it using the following command, from tkinter.scrolledtext import ScrolledTextExampleIn this example, we will create ... Read More

893 Views
Let us suppose we have created a tkinter application and now, we want to bundle the standalone application to make it portable and executable. We can use different Python packages that support various functionality to bundle the whole application code into an executable installer. These packages compress the code and convert the standalone application into an executable code.For a Windows-based user, we can use py2exe; for Linux, we can use Freeze; and for Mac, we can use py2app.ExampleIn this example, we have created a Windows-based application that prints “Hello World” on the screen. Initially, we will create a setup.py file ... Read More

22K+ Views
In order to place a tkinter window at the center of the screen, we can use the PlaceWindow method in which we can pass the toplevel window as an argument and add it into the center.We can also set the window to its center programmatically by defining its geometry.Example#Import the tkinter library from tkinter import * #Create an instance of tkinter frame win = Tk() #Set the geometry win.geometry("600x250") win.eval('tk::PlaceWindow . center') win.mainloop()OutputRunning the above code will create a centered window.

348 Views
Tkinter’s widgets support properties and attributes such as font-family and font size which can be specified using the font(‘Font-Family’, font-size) property.ExampleIn the following example, we have created a text label that can be configured by defining the font-family as “Times New Roman” and the font-size as “20”.#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= "This is a New Text", font=('Times New Roman bold', 20)) label.pack(padx=10, pady=10) win.mainloop()OutputRunning the above ... Read More

11K+ Views
Tkinter text widgets are used to create and display multiline text Input. It provides several functions and methods that are generally used to configure a text widget.Let us suppose we want to change the color of certain words in a text widget, then we can use the tag_add(tag name, range) method which selects the word we want to format. Once the word has been selected, we can change its color, background color, and other properties using the tag_config(properties) method.ExampleIn this example, we will configure the color of a selected word in the text widget.#Import required libraries from tkinter import * ... Read More

1K+ Views
Tkinter provides Button widgets to create a button for triggering an event. Let us suppose we have created a button that is already disabled in an application. In order to change the state of the button, we can use the state property.The state property is used to enable and disable a button in an application. In order to change the state of the application, we have two operations: state=DISABLED and state=NORMAL.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 ... Read More

6K+ Views
Tkinter Treeview widgets are used to display the hierarchy of the items in the form of a list. It generally looks like the file explorer in Windows or Mac OS.Let us suppose we have created a list of items using treeview widget and we want to clear the entire treeview, then we can use the delete() function. The function can be invoked while iterating over the treeview items.ExampleIn this example, we will create a treeview for the Programming Language and will clear the list of items using delete() operation.#Import the required library from tkinter import * from tkinter import ttk ... Read More

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