Aplicación sencilla hecha para practicar Python. Muestra frases aleatorias al presionar un botón.
- Interfaz hecha con CustomTkinter.
- Botón para generar una frase al azar.
- Lista de quotes personalizables.
- Ejecuta el script.
- Presiona Get a quote.
- La app mostrará una frase aleatoria.
pip install customtkinterimport random
import customtkinter as ctk
quote_msg = ['See you later, alligator!', 'After a while, crocodile.', 'Stay out of trouble.', 'I’m out of here.', 'Yamete, onii-chan~. UwU', 'Okay...bye, fry guy!', 'Peace out!', 'Peace out, bitch!', 'Gotta get going.', 'Out to the door, dinosaur.', "Don't forget to come back!", 'Smell ya later!', 'In a while, crocodile.', 'Adios, amigo.', 'Begone!', 'Arrivederci.', 'Never look back!', 'So long, sucker!', 'Au revoir!', 'Later, skater!', "That'll do pig. That'll do.", 'Happy trails!', 'Smell ya later!', 'See you soon, baboon!', 'Bye Felicia!', 'Sayonara!', 'Ciao!', 'Well.... bye.', 'Delete your browser history!', 'See you, Space Cowboy!', 'Change da world. My final message. Goodbye.', 'Find out on the next episode of Dragonball Z...', 'Choose wisely!']
def getQuote():
try:
quote = random.choice(quote_msg)
label_result.configure(text=f"Quote: '{quote}'")
except:
label_result.configure(text="Not quotes")
ctk.set_appearance_mode("dark-green")
app = ctk.CTk()
app.geometry("500x300")
app.title("App quotes")
my_font = ctk.CTkFont(family="Times New Roman", size=20, weight="bold")
label_result = ctk.CTkLabel(app, text="Quote:", font=my_font)
label_result.pack(pady=20)
btn = ctk.CTkButton(app, text="Get a quote", font=my_font, command=getQuote)
btn.pack(pady=20)
app.mainloop()Libre para usar y modificar.