58 lines
1.7 KiB
Python
58 lines
1.7 KiB
Python
|
import tkinter as tk
|
||
|
|
||
|
|
||
|
window = tk.Tk()
|
||
|
window.geometry("606x606")
|
||
|
window.configure(background="cyan")
|
||
|
|
||
|
title_icon = tk.PhotoImage(file = "./imgs/devfzn_64x64.png")
|
||
|
window.iconphoto(False, title_icon)
|
||
|
|
||
|
#logo = tk.PhotoImage(file = "./imgs/devfzn_250x250.png")
|
||
|
#logoimage = tk.Label(image=logo)
|
||
|
#logoimage.place(x=3, y=3, width=600, height=600)
|
||
|
|
||
|
# Re-asignable
|
||
|
photo1 = tk.PhotoImage(file = "./imgs/devfzn_250x250.png")
|
||
|
photobox1 = tk.Label(window, image=photo1)
|
||
|
photobox1["image"] = photo1
|
||
|
photobox1.place(x=3,y=3,width=600,height=600)
|
||
|
|
||
|
sel_name = tk.StringVar(window)
|
||
|
sel_name.set("Selecciona nombre")
|
||
|
lst_name = tk.OptionMenu(window, sel_name, "Bob", "Ret", "Znorb")
|
||
|
lst_name.place(x=253, y=75)
|
||
|
|
||
|
photo2 = tk.PhotoImage(file = "./imgs/img_4.png")
|
||
|
photobox2 = tk.Label(window, image=photo2)
|
||
|
photobox2.place(x=203,y=203,width=250,height=250)
|
||
|
|
||
|
lbl_msg = tk.Message(text='', font="Verdana 48")
|
||
|
lbl_msg.place(x=80, y=520, width=420, height=60)
|
||
|
lbl_msg["justify"] = "center"
|
||
|
|
||
|
def clicked():
|
||
|
sel = sel_name.get()
|
||
|
msg = f"Hola {sel}"
|
||
|
lbl_msg["text"] = msg
|
||
|
match sel:
|
||
|
case 'Bob':
|
||
|
photo = tk.PhotoImage(file = "./imgs/img_1.png")
|
||
|
photobox2.image = photo
|
||
|
case 'Ret':
|
||
|
photo = tk.PhotoImage(file = "./imgs/img_2.png")
|
||
|
photobox2.image = photo
|
||
|
case 'Znorb':
|
||
|
photo = tk.PhotoImage(file = "./imgs/img_3.png")
|
||
|
photobox2.image = photo
|
||
|
case _:
|
||
|
photo = tk.PhotoImage(file = "./imgs/devfzn_250x250.png")
|
||
|
photobox2.image = photo
|
||
|
photobox2["image"] = photo
|
||
|
photobox2.update()
|
||
|
|
||
|
button = tk.Button(text="Click", command=clicked)
|
||
|
button.place(x=253, y=30, width=150, height=25)
|
||
|
|
||
|
window.mainloop()
|