Tkinter Widget config() Method
If some of the properties are not created, you can use the config( ) method if you want to create or change them during program execution in the future. The parameters for setting properties in this method are the same as those used during creation.
Example
The counter is designed in such a way that this program will update the counter contents once per second.
"""
Set the config method of the control display
"""
from tkinter import *
counter = 0 # Global Variables for Counting
def run_counter(digit): # Update of digital variable content
def counting(): # Update digital method
global counter # Defining global variables
counter += 1
digit.config(text=str(counter)) # List digital content
# counter += 1
digit.after(1000,counting) # Call counting after one second
counting() # Continuous call
root = Tk()
root.title("apidemos.com")
digit = Label(root,bg="yellow",fg="blue",
height=3,width=10,
font="Helvetic 20 bold")
digit.pack()
run_counter(digit)
root.mainloop()
Output:
Lines 7 to 14 of the above program are the design of inline methods. Line 13 of the after( ) method, the first parameter 1000 means that the method with the second parameter note name will be called every 1 second, in this case the counting( ) method.