How to update information in the grid in Tkinter?

TkinterPythonGUI-Programming

Let us suppose that a Tkinter application has widgets placed in the window using the Grid Geometry Manager. In order to change the properties of the Tkinter widgets, we can use configure(**options) method. While rendering the widgets in the window, we have to assign the constructor to a variable that gives access to change the widget’s property globally.

Example

# Import the required libraries
from tkinter import *

# Create an instance of tkinter frame or window
win=Tk()

# Set the size of the window
win.geometry("700x350")

# Add a Label widget and assign it to a new variable
label=Label(win, text="This is Houstan Control. " "We've detected a new Mission", background="skyblue",font=('Aerial 11'))
label.grid(row=0, column=2)

win.mainloop()

Output

Running the above code will display a window that has a label widget aligned to the leftmost of the window.

raja
Published on 18-Jun-2021 14:11:38
Advertisements