tkinter stringvars are created to keep track of the bookmark' name and urland both are initialized with the passed-in values if the dialog is being used for editing namelabel nameentry urllabel urlentry okbutton cancelbutton figure the bookmarks program' add/edit dialog' layout frame tkinter frame(selfnamelabel tkinter label(frametext="name:"underline= nameentry tkinter entry(frametextvariable=self namevarnameentry focus_set(urllabel tkinter label(frametext="url:"underline= urlentry tkinter entry(frametextvariable=self urlvarokbutton tkinter button(frametext="ok"command=self okcancelbutton tkinter button(frametext="cancel"command=self closenamelabel grid(row= column= sticky=tkinter wpady= padx= nameentry grid(row= column= columnspan= sticky=tkinter ewpady= padx= urllabel grid(row= column= sticky=tkinter wpady= padx= urlentry grid(row= column= columnspan= sticky=tkinter ewpady= padx= okbutton grid(row= column= sticky=tkinter ewpady= padx= cancelbutton grid(row= column= sticky=tkinter ewpady= padx= the widgets are created and laid out in gridas illustrated in figure the name and url text entry widgets are associated with the corresponding tkinter stringvars and the two buttons are set to call the self ok(and self close(methods shown further on frame grid(row= column= sticky=tkinter nsewframe columnconfigure( weight= window self winfo_toplevel(window columnconfigure( weight= it only makes sense for the dialog to be resized horizontallyso we make the window frame' second column horizontally resizable by setting its column weight to --this means that if the frame is horizontally stretched the widgets