Mundo em Python

Saudação (em Portugal para homem ou mulher)

from tkinter import *

root = Tk()
root.geometry("400x300")
root.resizable(0, 0)
root.config(bg="#103030")
root.title("Saudação") titulo = Label(
text="Saudação",
font=("Arial", 28, "bold"),
bg="#103030",
fg="#49e3e3"
)
titulo.place(relx=0.2, rely=0.05) opcao = StringVar() rb1 = Radiobutton(
text="Mulher",
variable=opcao,
value="1",
font=("Arial", 20, "bold"),
bg="#103030",
fg="white",
selectcolor="#103030"
) rb2 = Radiobutton(
text="Homem",
variable=opcao,
value="2",
font=("Arial", 20, "bold"),
bg="#103030",
fg="white",
selectcolor="#103030"
) rb1.place(relx=0.05, rely=0.24)
rb2.place(relx=0.58, rely=0.24) def app():
op = opcao.get() if op == "1":
mensagem = "Senhora\Dona\Menina"
elif op == "2":
mensagem = "Senhor\Dom"
else:
mensagem = "Escolhe uma opção!"

resultado_texto.config(text=mensagem) botao = Button(text="Saudar", command=app)
botao.place(relx=0.45, rely=0.38) resultado_texto = Label(
text="",
font=("Arial", 12, "bold"),
bg="#cfe2f3"
)
resultado_texto.place(relx=0.05, rely=0.5, relwidth=0.9, relheight=0.4) root.mainloop()
0