add pereodic func
This commit is contained in:
29
main.py
Normal file
29
main.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import tkinter as tk
|
||||
import time
|
||||
|
||||
# Create the main window
|
||||
root = tk.Tk()
|
||||
|
||||
# Create the label before the table
|
||||
label_before_table = tk.Label(root, text="11111", font=("Helvetica", 14))
|
||||
label_before_table.grid(row=0, column=2, columnspan=2)
|
||||
|
||||
# Create the labels for the table with font size 14 and centered text
|
||||
label1 = tk.Label(root, text="Label 1", font=("Helvetica", 14), anchor='center')
|
||||
label2 = tk.Label(root, text="Label 2", font=("Helvetica", 14), anchor='center')
|
||||
label3 = tk.Label(root, text="Label 3", font=("Helvetica", 14), anchor='center')
|
||||
label4 = tk.Label(root, text="Label 4", font=("Helvetica", 14), anchor='center')
|
||||
|
||||
# Use grid geometry manager to arrange the labels in a 2x2 structure
|
||||
# with more space between the columns and centered labels
|
||||
label1.grid(row=1, column=0, padx=(0, 20), pady=(10, 10), sticky='nsew')
|
||||
label2.grid(row=1, column=1, padx=(20, 0), pady=(10, 10), sticky='nsew')
|
||||
label3.grid(row=2, column=0, padx=(0, 20), pady=(10, 10), sticky='nsew')
|
||||
label4.grid(row=2, column=1, padx=(20, 0), pady=(10, 10), sticky='nsew')
|
||||
|
||||
# Run the while loop to update the label text
|
||||
def update_label():
|
||||
label1.config(text="New Text for Label 1")
|
||||
root.after(1000, update_label) # repeat every 1000ms
|
||||
|
||||
update_label()
|
||||
Reference in New Issue
Block a user