after the dialog has been closed the caller checks the accepted variableand if trueretrieves the name and url that were added or edited thenonce the mainwindow editadd(or mainwindow editedit(method has finishedthe addeditform object goes out of scope and is scheduled for garbage collection summary ||this gave you flavor of gui programming using the tk gui library tk' big advantage is that it comes as standard with python but it has many drawbacksnot the least of which is that it is vintage library that works somewhat differently than most of the more modern alternatives if you are new to gui programmingkeep in mind that the major cross-platform competitors to tk--pygtkpyqtand wxpython--are all much easier to learn and use than tkand all can achieve better results using less code furthermorethese tk competitors all have more and better python-specific documentationfar more widgetsand better look and feeland allow us to create widgets from scratch with complete control over their appearance and behavior although tk is useful for creating very small programs or for situations where only python' standard library is availablein all other circumstances any one of the other cross-platform libraries is much better choice exercises ||the first exercise involves copying and modifying the bookmarks program shown in this the second exercise involves creating gui program from scratch copy the bookmarks-tk pyw program and modify it so that it can import and export the dbm files that the bookmarks py console program (created as an exercise in uses provide two new menu options in the file menuimport and export make sure you provide keyboard shortuts for both (keep in mind that ctrl+ is already in use for edit-editsimilarlycreate two corresponding toolbar buttons this involves adding about five lines of code to the main window' initializer two methods to provide the functionality will be requiredfileimport(and fileexport()between them fewer than lines of code including error handling for importing you can decide whether to merge imported bookmarksor to replace the existing bookmarks with those imported the code is not difficultbut does require quite bit of care solution (that merges imported bookmarksis provided in bookmarks-tk_ans py