Answers for "how to make input box if else statement in tkinter"

0

how to make input box if else statement in tkinter

import tkinter

root = tkinter.Tk()
root.geometry("300x300")
root.title("Try code")

entry = tkinter.Entry(root)
entry.pack()
print(entry.get())
def on_button():
    if entry.get() == "Screen" or entry.get() == "screen": #corrected
        slabel = tkinter.Label(root, text="Screen was entered")
        slabel.pack()
    else:
        tlabel = tkinter.Label(root, text="")
        tlabel.pack()

button = tkinter.Button(root, text="Enter", command=on_button)
button.pack()

root.mainloop()
Posted by: Guest on February-17-2021

Code answers related to "how to make input box if else statement in tkinter"

Python Answers by Framework

Browse Popular Code Answers by Language