mς %U²Ic@sdZdkTdkZdefd„ƒYZdefd„ƒYZdefd„ƒYZd „Zd efd „ƒYZd „Z d efd„ƒYZ d„Z e djoWe ƒZeiƒedddddƒGHe ddddddƒ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 (t*NtDialogcBs_tZdZed„Zd„Zd„Zd„Zed„Zed„Z d„Z d„Z RS( sZClass to open dialogs. This class is intended as a base class for custom dialogs cCs ti||ƒ|i|ƒ|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__tselftparentt transientttitletNonetresulttFrametbodyt initial_focustpackt buttonboxtwait_visibilitytgrab_settprotocoltcanceltgeometryt winfo_rootxt winfo_rootyt focus_sett wait_window(RRR R((t2/data/zmath/lib/python2.4/lib-tk/tkSimpleDialog.pyR&s(          / cCsd|_ti|ƒdS(sDestroy the windowN(R RRRtdestroy(R((RRPs 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((RRXsc Csΐt|ƒ}t|ddddd|idtƒ}|idtdd d d ƒt|dd ddd|i ƒ}|idtdd d d ƒ|i d |iƒ|i d |i ƒ|iƒdS(s[add standard button box. override if you do not want the standard buttons ttexttOKtwidthi tcommandtdefaulttsideRiRtCancelssN( R RtboxtButtontoktACTIVEtwRtLEFTRtbind(RR%R)((RRas '!cCsN|iƒp|iiƒdSn|iƒ|iƒ|iƒ|iƒdS(N(RtvalidateRRtwithdrawtupdate_idletaskstapplyR(Rtevent((RR'vs     cCs/|idj o|iiƒn|iƒdS(N(RRR RR(RR0((RRƒ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. iN((R((RR,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((RR/–s( t__name__t __module__t__doc__R RRRRR'RR,R/(((RRs  *   t _QueryDialogcBs8tZddddd„Zd„Zd„Zd„ZRS(NcCsX|pdk}|i}n||_||_||_||_ti |||ƒdS(N( RtTkintert _default_roottpromptRtminvaluetmaxvaluet initialvalueRRR (RR R7R:R8R9RR5((RR₯s      cCsd|_ti|ƒdS(N(R RtentryRR(R((RRΆs cCs­t|d|idtƒ}|idddddtƒt|dd ƒ|_ |i idd dddtt ƒ|i o-|i i d|i ƒ|i i dtƒn|i S( NRtjustifytrowiRitstickytnameR;i(tLabelRRR7R*R)tgridtWtEntryR;tER:tinsertt select_rangetEND(RRR)((RRΊs# cCsηdk}y|iƒ}Wn4tj o(|id|idd|ƒdSnX|idj o5||ijo%|idd|id|ƒdSn|i dj o5||i jo%|idd|i d|ƒdSn||_d S( Ns Illegal values Please try againRis Too smalls2The allowed minimum value is %s. Please try again.s Too larges2The allowed maximum value is %s. Please try again.i( t tkMessageBoxRt getresultR t ValueErrort showwarningt errormessageR8R R9(RRHR ((RR,Θs(              (R1R2R RRRR,(((RR4£s  t _QueryIntegercBstZdZd„ZRS(NsNot an integer.cCst|iiƒƒS(N(tintRR;tget(R((RRIοs(R1R2RLRI(((RRMν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 N(RMR R7tkwtdR (R R7RPRQ((Rt askintegerςs t _QueryFloatcBstZdZd„ZRS(NsNot a floating point value.cCst|iiƒƒS(N(tfloatRR;RO(R((RRIs(R1R2RLRI(((RRSscKst|||}|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 N(RSR R7RPRQR (R R7RPRQ((Rtaskfloats t _QueryStringcBs#tZd„Zd„Zd„ZRS(NcOsH|idƒo|d|_|d=n d|_ti|||ŽdS(Ntshow(RPthas_keyRt_QueryString__showR R4Rtargs(RRZRP((RRs    cCs=ti||ƒ}|idj o|id|iƒn|S(NRW(R4RRRR;RYR t configure(RRR;((RRscCs |iiƒS(N(RR;RO(R((RRI"s(R1R2RRRI(((RRVs  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 N(RVR R7RPRQR (R R7RPRQ((Rt askstring%s t__main__tSpams Egg countR:i sEgg weight (in tons)R8iR9ids Egg label(R3R5tosRRR4RMRRRSRURVR\R1tTktroottupdate( R4RVRRRaRUR\RSRMRR_((Rt?s  „J