button is attached (reallythe mainloop callbut to really understand how such springloaded button can be usefulwe need to move on and study client gui in the next section dialog demo launcher bar so farwe've seen handful of standard dialogsbut there are quite few more instead of just throwing these up in dull screenshotsthoughlet' write python demo script to generate them on demand here' one way to do it first of allin example - we write module to define table that maps demo name to standard dialog call (and we use lambda to wrap the call if we need to pass extra arguments to the dialog functionexample - pp \gui\tour\dialogtable py define name:callback demos table from tkinter filedialog import askopenfilename get standard dialogs from tkinter colorchooser import askcolor they live in lib\tkinter from tkinter messagebox import askquestionshowerror from tkinter simpledialog import askfloat demos 'open'askopenfilename'color'askcolor'query'lambdaaskquestion('warning''you typed "rm *"\nconfirm?')'error'lambdashowerror('error!'"he' deadjim")'input'lambdaaskfloat('entry''enter credit card number' put this table in module so that it might be reused as the basis of other demo scripts later (dialogs are more fun than printing to stdoutnextwe'll write python scriptshown in example - which simply generates buttons for all of this table' entries-use its keys as button labels and its values as button callback handlers example - pp \gui\tour\demodlg py "create bar of simple buttons that launch dialog demosfrom tkinter import from dialogtable import demos from quitter import quitter get base widget set button callback handlers attach quit object to me class demo(frame)def __init__(selfparent=none**options)frame __init__(selfparent**optionsself pack(label(selftext="basic demos"pack(for (keyvaluein demos items()button(selftext=keycommand=valuepack(side=topfill=bothquitter(selfpack(side=topfill=both tkinter tourpart