win title('enter unpack parameters'var makeformrow(winlabel='input file'width= win bind(''lambda eventwin destroy()win grab_set(win focus_set(make myself modal win wait_window(till ' destroyed on return return var get(or closed by wm action def rununpackdialog()input unpackdialog(if input !''print('unpacker:'inputunpack(ifile=inputprefix=''get input from gui do non-gui file stuff run with input from dialog if __name__ ="__main__"button(nonetext='popup'command=rununpackdialogpack(mainloop(the "browsebutton in figure - pops up file selection dialog just as the packdlg form did instead of an ok buttonthis dialog binds the enter key-press event to kill the window and end the modal wait state pauseon submissionthe name of the packed file is passed to the main function of the unpacker script shown earlier to perform the actual file scan process room for improvement all of this works as advertised--by making command-line tools available in graphical form like thisthey become much more attractive to users accustomed to the gui way of life we've effectively added simple gui front-end to command-line tools stilltwo aspects of this design seem prime for improvement firstboth of the input dialogs use common code to build the rows of their input formsbut it' tailored to this specific use casewe might be able to simplify the dialogs further by importing more generic form-builder module instead we met general form builder code in and and we'll meet more later--see the form py module in for pointers on further genericizing form construction secondat the point where the user submits input data in either form dialogwe've lost the gui trail--the gui is blockedand messages are routed back to the console the gui is technically blocked and will not update itself while the pack and unpack utilities runalthough these operations are fast enough for my files as to be negligiblewe would probably want to spawn these calls off in threads for very large files to keep the main gui thread active (more on threads later in this the console issue is more blatantpacker and unpacker messages still show up in the stdout console windownot in the gui (all the filenames here include full directory paths if you select them with the gui' browse buttonscourtesy of the standard open dialog) gui coding techniques