I am constructing some sort of a status bar which allows the user to update their status while in a social network. It consists of an entry field and a 'update' button beside it.
What I hope to do is upon activation of the button 'update' the contents in status entry box should dissappear and reappear in the text box below it.
However I can not get the information entered into the status entry box with status.get()
Here is what I have:
from Tkinter import *
def status_on(status1, text1, statusentry):
text1.insert(INSERT, status1) #the text only displays the part 'name is: '
statusentry.delete(0, END)
def status_off(text1):
text1.delete(1.0, END)
if __name__=='__main__':
window = Tk()
frame = Frame(window)
frame.grid(rowspan=100, columnspan=100)
short_status_label = name + 'is: ' #the label on status bar
statuslabel = Label(frame, text=short_status_label)
statuslabel.grid(row=14, column=3)
statusentry = Entry(frame, textvariable=status)
statusentry.grid(row=14, column=4)
status1 = status.get()# status1 should now contain the value of status but it doesn't
print status1 # nothing is printed
status1 = name + ' is' + ' ' + status1
text1 = Text(frame, height=1, width=25)#the text box that is supposed to display the status info
text1.grid(row=15, column=3)
status_off(text1)
update = Button(frame, text='Update', command=\
lambda: status_on(status1, text1, statusentry))
update.grid(row=14, column=6)
And help would be greately appreciated!