Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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()
Comment

PREVIOUS NEXT
Code Example
Python :: # logging 
Python :: debugging python 
Python :: dataframe concatenate 
Python :: how to install qrcode module in python 
Python :: dictionary python 
Python :: python get colorscale 
Python :: matplotlib boxplot change size of outliers 
Python :: how to check mix types in pandas column 
Python :: pandas combine year month day column to date 
Python :: how to wait for loading icon to disappear from the page using selenium python 
Python :: find out length of a string in pixels python 
Python :: HOW TO CREATE A DATETIME LIST QUICK 
Python :: dict to list python 
Python :: detect if usb is plugged in python 
Python :: change state enabled tkinter 
Python :: format binary string python 
Python :: stackoverflow: install old version of networkx 
Python :: argparse for Command-Line Interface (CLI) 
Python :: fonts in python 
Python :: decimal hour to hour minute python 
Python :: create django model field based on another field 
Python :: tensorflow conv2d 
Python :: scapy get packet source ip address python 
Python :: how do i get auth user model dynamically in django? 
Python :: sudo in python 
Python :: django admin text box 
Python :: python system performance 
Python :: if a specific column name is present drop tyhe column 
Python :: convert to string in python 
Python :: pandas series to dataframe index as column 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =