|
| 1 | +import tkinter as tk |
| 2 | +from random import choice |
| 3 | +import pyttsx3 |
| 4 | + |
| 5 | +engine = pyttsx3.init() |
| 6 | + |
| 7 | +slime = ["peanut butter", "garlic butter", "mayo", "ketchup", "lard", "liquid gallium", "orange juice", "oil", "fart juice", "rotten denmark", "skunk juice", "moldy", "pickle", "mustard", "rancid",\ |
| 8 | + "spoiled"] |
| 9 | +main_course = ["sandwich", "burger", "chicken nuggets", "toilet paper", "bacon sandwich", "dead possum", "onion", "roadkill", "slushie"] |
| 10 | +dessert = ["butter", "cookie", "potting soil", "bacon", "fbi agent", "cloud", "water", "mold", "cia agent", "nsa agent", "department of justice lawyer"] |
| 11 | + |
| 12 | +use_voice = 1 |
| 13 | + |
| 14 | +generated_foods = [] |
| 15 | + |
| 16 | +def generate_text(): |
| 17 | + text_box.delete(1.0, tk.END) # Clear the text box |
| 18 | + global generated_foods # Access the global variable |
| 19 | + generated_foods = [] # Reset the list |
| 20 | + for _ in range(10): |
| 21 | + str1 = f"{choice(slime)} {choice(main_course)}, dessert is {choice(dessert)} with {choice(slime)}" |
| 22 | + text_box.insert(tk.END, str1 + "\n\n") |
| 23 | + generated_foods.append(str1) |
| 24 | + |
| 25 | +def speak_text(): |
| 26 | + global generated_foods # Access the global variable |
| 27 | + for i in generated_foods: |
| 28 | + if use_voice: |
| 29 | + engine.say(i) |
| 30 | + engine.runAndWait() |
| 31 | + |
| 32 | +# Create the main window |
| 33 | +window = tk.Tk() |
| 34 | +window.title("BirdMenu v1.0") |
| 35 | + |
| 36 | +# Create a text box to display the generated food combinations |
| 37 | +text_box = tk.Text(window) |
| 38 | +text_box.pack(expand=True, fill='both') |
| 39 | + |
| 40 | +# Create buttons for generating text and speaking text |
| 41 | +generate_button = tk.Button(window, text="Generate Text", command=generate_text) |
| 42 | +generate_button.pack(side=tk.LEFT, expand=True, fill='both') |
| 43 | + |
| 44 | +speak_button = tk.Button(window, text="Speak Text", command=speak_text) |
| 45 | +speak_button.pack(side=tk.LEFT, expand=True, fill='both') |
| 46 | + |
| 47 | +window.mainloop() |
0 commit comments