import sys from Tkinter import * makemodal = (len(sys.argv) > 1) def dialog(): win = Toplevel() Label(win, text='information').pack() Button(win, text='OK', command=win.destroy).pack() if makemodal: win.focus_set() win.grab_set() win.wait_window() print 'dialog exit' root = Tk() Button(root, text='popup', command=dialog).pack() root.mainloop()
18.10.Dialog | ||||
18.10.1. | OK Cancel message box | |||
18.10.2. | Color dialog | |||
18.10.3. | File dialog | |||
18.10.4. | Question dialog | |||
18.10.5. | Error dialog | |||
18.10.6. | Message box | |||
18.10.7. | Model dialog | |||
18.10.8. | Popup dialog | |||
18.10.9. | A quit button that verifies exit requests |