Untitled
unknown
plain_text
2 years ago
1.7 kB
4
Indexable
import random import time import tkinter as tk import keyboard import threading def operazione1(): time.sleep(2) welcome_label.config(text="Sto eseguendo la prima operazione") print("esguo un operazione") time.sleep(2) welcome_label.config(text="Sto eseguendo la seconda operazione") print("esguo un operazione") time.sleep(2) welcome_label.config(text="Sto eseguendo la terza operazione") print("esguo un operazione") time.sleep(2) welcome_label.config(text="Chiusura Programma...") time.sleep(4) global done done = True def Esegui_Programma(): threading.Thread(target=operazione1).start() def window_close(): window.destroy() def chiudi_finestra(): if (done): print("done è vero! " + str(done)) window_close() else: window.after(100, chiudi_finestra) done = False #----------FINESTRA E ATTRIBUTI--------------# window = tk.Tk() window.title("Test Program") window.resizable(False, False) window.configure(background="black") window.geometry("360x100+1550+0") window.attributes('-topmost',True) #----------LABEL E BOTTONI--------------# welcome_label = tk.Label(window,text="Inizializzo...",font=("Helvetica", 15),bg="black",fg="white") welcome_label.grid(row=0, column=0, sticky="N", padx=20, pady=10) button1 = tk.Button(text="Close", command=window_close) button1.grid(row=2, column=0, sticky="WE", pady=10, padx=10) avvia_button = tk.Button(window, text="Avvia Programma", command=Esegui_Programma) avvia_button.grid(row=2, column=2, sticky="WE", pady=10, padx=10) window.after(100,chiudi_finestra) window.mainloop()
Editor is loading...