Oct-19-2019, 02:41 AM
Good evening everyone, I am trying to make a menu for one of my games. The idea is,
you see the start menu
you hit the start button
then it goes to the main game menu.
It seems simple but I have run into complications.
NOTE: I am new to Tkinter, I don't know any complicated workarounds, I am so new that you can tell my abilities from the code I have already written (for the most part). As it turns out, the transition from 3+ years of console to GUI is proving to be difficult
Here is my code:
you see the start menu
you hit the start button
then it goes to the main game menu.
It seems simple but I have run into complications.
NOTE: I am new to Tkinter, I don't know any complicated workarounds, I am so new that you can tell my abilities from the code I have already written (for the most part). As it turns out, the transition from 3+ years of console to GUI is proving to be difficult
Here is my code:
import tkinter from tkinter import * #Window Setup window = Tk() window.title("WIP NAME") window.geometry("650x400") #Variables Happy = 0 #Counter for the peoples opinion Survival = 0 #Water, Food, etc. Social = 0 #Events Awards = 0 #Simply to keep the player playing #Definitions def mainmenu(): #main menu starttxt = Label(window, text = "WIP NAME") #text starttxt.pack() startbtn = Button(window, text = "START", command = gamestart) #starts the game (I want to check if this is pressed and then proceed to forget the pack if it is) startbtn.pack() def gamestart(): #Starts the game Label(window, text = "itworked") #mainloop mainmenu() window.mainloop()Any pointers in the right direction would be greatly appreciated, thanks in advance.