from tkinter import *
from tkinter import ttk
import pytz
root =Tk()
root.title("Relógio Mundial")
root.geometry("300x300")
root.resizable(0, 0)
root.config(bg="#103030")
def mostrar_horario_selecionado():
fuso_horario_selecionado = combobox_fusos_horarios.get()
horario_atual = pytz.datetime.datetime.now(pytz.timezone(fuso_horario_selecionado))
resultado_texto.config(text=f"Hora actual em {fuso_horario_selecionado}:\n"
f" {horario_atual.strftime('%d-%m-%Y %H:%M:%S')}")
root.after(1000, mostrar_horario_selecionado)
titulo = Label(text="Relógio Mundial",
font=("Arial", "25", "bold"), bg="#103030", fg="#49e3e3")
titulo.place(relx=0.08, rely=0.05)
fusos_horarios = pytz.all_timezones
combobox_fusos_horarios = ttk.Combobox(root, values=fusos_horarios)
combobox_fusos_horarios.place(relx=0.25,rely=0.35)
combobox_fusos_horarios.set('Europe/Lisbon')
label_horario_atual =Label(root, text="Localização",font=("Arial", "15", "bold"),bg="#103030", fg="#49e3e3")
label_horario_atual.place(relx=0.3,rely=0.23)
but1 = Button(text="Mostrar Horário", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=mostrar_horario_selecionado)
but1.place(relx=0.05, rely=0.5, relwidth=0.5, relheight=0.1)
but_sair = Button(text="Sair", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=root.destroy)
but_sair.place(relx=0.6, rely=0.5, relwidth=0.3, relheight=0.1)
resultado_texto = Label(font=("Arial", 12, "bold"), bg="#cfe2f3")
resultado_texto.place(relx=0.05, rely=0.68, relwidth=0.9, relheight=0.3)
root.mainloop()