am adding a GUI into a python database and i was wondering if there is any way for text to be already in an entry box when it appears. The window is for adding movies to the database so i would like the following, please enter the movies title: [Title ], with [] being my entry box.

def addmovie():
addboard = Tkinter.Toplevel()
addboard.title("Add a movie")
#addboard(padx=10, pady=10)
print "add"
#adding the title

lbtitle = Tkinter.Label(addboard, text = "Enter the movie's title:")
lbtitle.grid(row = 1, column = 1)
entitle = Tkinter.Entry(addboard)
entitle.grid(row = 1, column = 3)
#adding the director
lbdirector = Tkinter.Label(addboard, text = "Enter the mmovie's director:")
lbdirector.grid(row = 2, column = 1)
endirector = Tkinter.Entry(addboard)
endirector.grid(row = 2, column = 3)
#adding the year
lbyear = Tkinter.Label(addboard, text = "Enter the movie's year:")
lbyear.grid(row = 3, column = 1)
enyear = Tkinter.Entry(addboard)
enyear.grid(row = 3, column = 3)
#if a value is left blank program will ask what to do
#to be added later

#The button and the commands to put it all together
btnok = Tkinter.Button(addboard, text = "Continue", bg = 'red', command = addcontinue)
btnok.grid(row= 5, column = 4)
btncancel = Tkinter.Button(addboard, text = "Cancel", bg= 'red', command=addboard.destroy)
btncancel.grid(row = 5, column = 1)

def addcontinue():
id = len(movie_list) + 1
title = entitle.get()
director = endirector.get()
year = enyear.get()
movie_list.append(Movie(title, director, year, id))

also i am having trouble with recalling the entry text after the continue button is pressed. What is the correct way to move the entered text from the entries into the next section where it will be processed?

7 Years
Discussion Span
Last Post by pyTony

haha i copy and pasted my code from an ide it didnt copy my indentation. thanks for pointing me to the page.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.