
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

6K+ Views
We have used Label widget to group all the widgets in the application. A Label widget takes text and images in the constructor that sets the label with the position in the top-left corner of the window. However, to change or update the image associated with the Label, we can use a callable method where we provide the information of other images.ExampleIn the following example, we will create a button to update the Label image.#Import the required library from tkinter import* from PIL import Image, ImageTk #Create an instance of tkinter frame win= Tk() #Define geometry of the ... Read More

368 Views
In a tkinter GUI skeleton, we can add any number of widgets to make it more functional and operational. However, sometimes, it seems difficult to resize and position the widgets so that they don’t stick together and are non-variable in size. We can add padding using the widget pack manager to make every widget stand as one separate entity.Example#Import the required library from tkinter import* from tkinter import ttk #Create an instance of tkinter frame win= Tk() #Set the geometry win.geometry("750x250") #Create an Label Widget Label(win, text= "New Line Text", font= ('Helvetica 15 underline')).pack(pady=20) left=Button(win, text="Button1", font= ... Read More

2K+ Views
Validating the content is a necessary part of any featured application where we allow only the required data to be processed. An Entry Widget in tkinter is used to display single line text Input. However, we can validate the Entry widget to accept only digits or alphabets.Let us first create an Entry widget that accepts only digits input. So initially, we will create an Entry widget and using register(callback) function, we will call to validate the Entry widget which validates whenever a key is stroked. It returns a string that can be used to call a function. Then, calling the ... Read More

6K+ Views
Tkinter Text widget is used to create text fields that accept multiline user inputs. Let us suppose that in a text widget, we want to highlight some text. In order to highlight a specific text written in the text widget, tkinter provides the tag_add(tag, i, j) method. It adds tags to the specific text by defining the indexes, i and j.ExampleIn this example, we will create a window application that contains some text and a button which can be triggered to highlight the text.#Import tkinter library from tkinter import * #Create an instance of tkinter frame win= Tk() win.geometry("750x450") #Define a ... Read More

1K+ Views
Tkinter provides a variety of input widgets such as entry widget, text widget, listbox, combobox, spinbox, checkbox, etc. Checkboxes are used for taking validity input and the state gets active whenever the user clicks on the checkbutton. In terms of a particular application, we can enable and disable the state of CheckButtons by using the state property.Example#Import the required library from tkinter import* from tkinter import ttk #Create an instance of tkinter frame win= Tk() #Set the geometry win.geometry("750x250") #Create CheckButtons chk= ttk.Checkbutton(win, text="Python") chk.pack() chk.config(state=DISABLED) win.mainloop()OutputRunning the example code will display a window with a check button that is ... Read More

19K+ Views
There are various attributes and properties in each tkinter widget to help us extend the functionality of the application. Tkinter Button widgets can be enabled and disabled by defining its state in the Button Object. The state attribute generally accepts two values Normal and Disabled which are used for enabling and disabling the button, respectively.Example#Import necessary Library from tkinter import * from tkinter import ttk from tkinter.filedialog import asksaveasfile #Create an instance of tkinter window win= Tk() #Set the geometry of tkinter window win.geometry("750x250") #Define the function to change the value in label widget def change_text(label): label.configure(text= "Hey, I ... Read More

10K+ Views
In this example, we will create a timer using Python Tkinter. For displaying time, we will use the Time Module in Python.Initially, we will follow these steps to create the timer, Create three entry widget each for Hours, Minute and Seconds and set the value ‘00’ by default.Create a Button for setting the timer. It will call the function countdowntimer().Define a function countdowntimer() which does update once we click on the button to propagate the time.Example#Import the required library from tkinter import * import time #Create an instance of tkinter frame win = Tk() win.geometry('750x300') win.resizable(False, False) #Configure the background ... Read More

8K+ Views
Tkinter Label widgets are generally used to display text or images. In this example, we will see how to add a hyperlink on a Label widget in an application.In order to add a hyperlink, we can bind the label text with a button that makes it clickable. The open_new(url) method is used to define the function that opens a web browser to follow the link. The open_new(url) method is defined in the webbrowser module in Python which can be imported in the notebook using 'import webbrowser'.Example#Import the required libraries from tkinter import * import webbrowser #Create an instance of ... Read More

4K+ Views
Tkinter window is the native component of tkinter application that contains some frames, a group of widgets, and some other elements. A Tkinter frame has a group of too many widgets.Let us suppose that we have created a frame with some widgets and now we want to rename the title of the application. Frame titles are a necessary part of any application. We can change the title of the frame using the title("title") method.ExampleIn this example, we will create an application that will contain an entry widget and a button. The button is used to rename the title of the ... Read More

7K+ Views
Tkinter Button Widgets are a general way to provide Event Handling in a variety of applications. Sometimes, we may need to style the buttons which are defined in an application. In order to add styling in the button widgets, first create an instance of Button widget using a variable. Then, add some property like fontfamily, font-size, padding, etc. into it. The most general way to resize the button is by resizing the text in it.ExampleIn this example, we have created a button that can be resized by changing the value in the 'font' property.#Import tkinter library from tkinter import * ... Read More