I have been trying to make a graphics window for my python code but I don't know how to add buttons and I have looked at websites and it hasn't been for my edition (3.2.3) I have got some code now, is there anything wrong with this?
import tkinter
import tkinter as tk
root = tk.Tk()
root.title("Adventure game")
root.geometry("1820x1000")
root.mainloop()
class Window(Tk):
def __init__(self, parent):
Tk.__init__(self, parent)
self.parent = parent
self.initialize()
def initialize(self):
self.geometry("600x400+30+30")
wButton = Button(self, text='start', command = self.OnButtonClick())
wButton.pack()
def OnButtonClick(self):
top = Toplevel()
top.title("title")
top.geometry("300x150+30+30")
topButton = Button(top, text="OPTION_1", command = self.OnButtonPress())
topButton = Button(top, text="OPTION_2", command = self.OnButtonPress())
topButton.pack()
def OnButtonPress(self):
top = Toplevel()
top.title("title")
top.geometry("300x150+30+30")
topButton = Button(top, text="OPTION_1", command = self.destroy)
bottomButton = Button(top, text="OPTION_2", command = self.destroy)
topButton.pack()