Ñò 6ÕUc@sýdZddkTdefd„ƒYZdefd„ƒYZdefd„ƒYZd „Zd efd „ƒYZd „Zd efd„ƒYZ d„Z e djoSe ƒZ e iƒeddddƒGHeddddddƒGHe ddƒGHndS(súDialog boxes This module handles dialog boxes. It contains the following public symbols: Dialog -- a base class for dialogs askinteger -- get an integer from the user askfloat -- get a float from the user askstring -- get a string from the user iÿÿÿÿ(t*tDialogcBs_eZdZd d„Zd„Zd„Zd„Zd d„Zd d„Z d„Z d„Z RS( sZClass to open dialogs. This class is intended as a base class for custom dialogs cCs1ti||ƒ|iƒo|i|ƒn|o|i|ƒn||_d|_t|ƒ}|i |ƒ|_ |i ddddƒ|i ƒ|i ƒ|iƒ|i p ||_ n|id|iƒ|idj o/|id|iƒd|iƒdfƒn|i iƒ|i|ƒdS(s˜Initialize a dialog. Arguments: parent -- a parent window (the application window) title -- the dialog title tpadxitpadytWM_DELETE_WINDOWs+%d+%di2N(tToplevelt__init__twinfo_viewablet transientttitletparenttNonetresulttFrametbodyt initial_focustpackt buttonboxtwait_visibilitytgrab_settprotocoltcanceltgeometryt winfo_rootxt winfo_rootyt focus_sett wait_window(tselfR R R((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyR%s*           cCsd|_ti|ƒdS(sDestroy the windowN(R RRtdestroy(R((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyRTs cCsdS(s«create dialog body. return widget that should have initial focus. This method should be overridden, and is called by the __init__ method. N((Rtmaster((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyR\sc CsÀt|ƒ}t|ddddd|idtƒ}|idtdd d d ƒt|dd ddd|iƒ}|idtdd d d ƒ|id |iƒ|id |iƒ|iƒdS(s[add standard button box. override if you do not want the standard buttons ttexttOKtwidthi tcommandtdefaulttsideRiRtCancelssN(R tButtontoktACTIVERtLEFTRtbind(Rtboxtw((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyRes '!cCsS|iƒp|iiƒdS|iƒ|iƒz|iƒWd|iƒXdS(N(tvalidateRRtwithdrawtupdate_idletaskstapplyR(Rtevent((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyR&zs    cCs/|idj o|iiƒn|iƒdS(N(R R RR(RR0((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyRˆscCsdS(s¨validate the data This method is called automatically to validate the data before the dialog is destroyed. By default, it always validates OK. i((R((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyR,’scCsdS(s¡process the data This method is called automatically to process the data, *after* the dialog is destroyed. By default, it does nothing. N((R((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyR/›sN( t__name__t __module__t__doc__R RRRRR&RR,R/(((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyRs /    t _QueryDialogcBs8eZddddd„Zd„Zd„Zd„ZRS(cCs[|pddk}|i}n||_||_||_||_ti|||ƒdS(Niÿÿÿÿ(tTkintert _default_roottprompttminvaluetmaxvaluet initialvalueRR(RR R7R:R8R9R R5((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyRªs      cCsd|_ti|ƒdS(N(R tentryRR(R((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyR»s cCs­t|d|idtƒ}|idddddtƒt|dd ƒ|_|iidd dddttƒ|io-|ii d|iƒ|ii dt ƒn|iS( NRtjustifytrowiRitstickytnameR;i( tLabelR7R(tgridtWtEntryR;tER:tinsertt select_rangetEND(RRR+((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyR¿s# c Csáddk}y|iƒ}Wn1tj o%|id|idd|ƒdSX|idj o2||ijo"|idd|id|ƒdS|idj o2||ijo"|idd |id|ƒdS||_d S( Niÿÿÿÿs Illegal values Please try againR is Too smalls2The allowed minimum value is %s. Please try again.s Too larges2The allowed maximum value is %s. Please try again.i( t tkMessageBoxt getresultt ValueErrort showwarningt errormessageR8R R9R (RRHR ((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyR,Ís2       N(R1R2R RRRR,(((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyR4¨s    t _QueryIntegercBseZdZd„ZRS(sNot an integer.cCst|iiƒƒS(N(tintR;tget(R((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyRIôs(R1R2RLRI(((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyRMòscKst|||}|iS(s¼get an integer from the user Arguments: title -- the dialog title prompt -- the label text **kw -- see SimpleDialog class Return value is an integer (RMR (R R7tkwtd((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyt askinteger÷s t _QueryFloatcBseZdZd„ZRS(sNot a floating point value.cCst|iiƒƒS(N(tfloatR;RO(R((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyRIs(R1R2RLRI(((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyRSscKst|||}|iS(s¶get a float from the user Arguments: title -- the dialog title prompt -- the label text **kw -- see SimpleDialog class Return value is a float (RSR (R R7RPRQ((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pytaskfloat s t _QueryStringcBs#eZd„Zd„Zd„ZRS(cOsH|idƒo|d|_|d=n d|_ti|||ŽdS(Ntshow(thas_keyt_QueryString__showR R4R(RtargsRP((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyRs    cCs=ti||ƒ}|idj o|id|iƒn|S(NRW(R4RRYR t configure(RRR;((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyR!scCs |iiƒS(N(R;RO(R((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyRI's(R1R2RRRI(((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyRVs  cKst|||}|iS(s¸get a string from the user Arguments: title -- the dialog title prompt -- the label text **kw -- see SimpleDialog class Return value is a string (RVR (R R7RPRQ((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyt askstring*s t__main__tSpams Egg countR:i sEgg weight (in tons)R8iR9ids Egg labelNi(R3R5RRR4RMRRRSRURVR\R1tTktroottupdate(((s+/usr/lib/python2.6/lib-tk/tkSimpleDialog.pyts ŠJ