Just messing around with tkinter for the first time and I dont know why my buttons are not working. Basically the input_grade is supposed to get a value from entry_for_grades which is quiz_amount and just print it on the same window but I keep getting back 0
I looked up and thought I was suppose to use lambda but it keeps giving me 0 regardless of what I have in entry and press ok
from tkinter import *
quiz_amount = IntVar()
def quiz():
quiz_window = Tk()
window(quiz_window)
quiz_window.title('Quiz Grades')
width = quiz_window.winfo_width()
height= quiz_window.winfo_height()
quiz_window.geometry('{}x{}'.format(width, height))
entry_for_grades = Entry(quiz_window, textvariable=quiz_amount)
entry_for_grades.pack()
grade_amount = Button(quiz_window,text='Ok',command=lambda:see_text(quiz_window)).place(x=85,y=60)
def see_text(window):
Label(window,text=float(quiz_amount.get())).place(x=85,y=90)
Tk()- I'm surprised this isn't causing an error, I guess something's changed since the version I use. - jasonharperToplevelinstead ofTkto make additional windows, then you can use the IntVar in any of them. - Novel