mercredi 31 mai 2017

Python tkinter - Arguing String Input for Entry( )

I am learning Python tkinter fundamentals, and cannot get my method called "Submit()" to argue the string value for my Entry1 variable. I have tried the .get() method for Entry1, but the console says the get attribute does not exist for Entry1. So I have resorted to asking the amazing wizards of stackoverflow. Thanks for your time, tkinter pros!

from tkinter import *

Window = Tk()

def Submit():
    Answer = Entry1.text
    if Answer == "byte":
    print("correct")

Label(Window, text="What do you call 8 bits?").grid(row=0)
Entry1 = Entry(Window, text="").grid(row=1)
Button(Window, text="SUBMIT", command=Submit).grid(row=2)

Window.mainloop()

Aucun commentaire:

Enregistrer un commentaire