[Python] Theme is not applying to the menu buttons on start

Discussão em 'Python' iniciado por Stack, Dezembro 16, 2024.

  1. Stack

    Stack Membro Participativo

    the menu theme is not applying to the buttons on start. Once you play through the quiz once and go back to the menu the menu theme then applies to the buttons

    def menu():
    def start_game():
    menu.destroy()
    quiz_main()

    def exit_game():
    menu.destroy()

    menu = tk.Tk()
    menu.title('Menu')
    menu.geometry('600x500')

    style = ThemedStyle(menu)
    style.theme_use("black")

    style.configure("Tbutton", font=("Helvetica", 20))
    style.configure("Exit", font=("Helvetica", 16))

    start_button = ttk.Button(
    menu,
    text="Start",
    command=start_game,
    state="Enabled"
    )
    start_button.pack(pady=40)

    start_button = ttk.Button(
    menu,
    text="Exit",
    command=exit_game,
    state="Enabled",
    )
    start_button.pack(pady=40)

    menu.mainloop()

    menu()


    I have tried to set a theme inside of the button code to no avail and I have tried switching the location of the menu theme itself to no avail

    Continue reading...

Compartilhe esta Página