Hello all, just making a quick check to see if anyone can help me fix my code. I need to show the result in an entry screen...
# Tkinter class template to test apps
try:
# Python2
import Tkinter as tk
except ImportError:
# Python3
import tkinter as tk
class MyApp(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
self.title("Tkinter basic class")
# use width x height + x_offset + y_offset (no spaces!)
self.geometry("300x150+50+50")
self['bg'] = 'green'
self.createEight()
def createEight(self):
top=self.winfo_toplevel()
top.rowconfigure(0, weight=1)
top.columnconfigure(0, weight=1)
self.rowconfigure(0, weight=1)
self.columnconfigure(0, weight=1)
self.button8 = tk.Button(self, text=" 8 ",
font=("Arial", 12), bg="white", fg="blue",
cursor="crosshair", command=lambda: self.click('8'))
self.button8.grid(row=2, column=1, sticky='nesw')
def click(self, val):
s = "Button " + val + " clicked"
# show result in title
self.title(s)
app = MyApp()
app.mainloop()
I've tried everything and it gives me all types of errors. Any help will be good. :)