Reputation: 241
I have written a script in python 3.4 and i want to put a if-else condition in entry box of tkinter. Is this possible?
Note: Currently the code is not working correctly. Please let me know, what i have written in my code is possible or not ?
from tkinter import *
root = Tk()
a = ""
b = "hello"
e = Entry(root)
e.pack()
e.insert(0, if(len(a) == 0) b else a)
root.mainloop()
Upvotes: 1
Views: 317