zfc@sFdZddlTdddYZedkrBdZendS( s'A simple but flexible modal dialog box.i(t*t SimpleDialogcBsVeZdgd d d d dZdddZdZdZdZdZRS( tc Cs|rt|d||_nt||_|rV|jj||jj|nt|jd|dd|_|jjdddtt|j|_ |j j||_ ||_ ||_ |jj d|jxtt|D]u}||} t|j d| d ||d } ||krI| jd td d n| jdtdtddqW|jjd|j|j|dS(Ntclass_ttexttaspectitexpanditfillstcommandcSs |j|S(N(tdone(tselftnum((s+/usr/lib64/python2.7/lib-tk/SimpleDialog.pytRtrelieft borderwidthitsidetWM_DELETE_WINDOW(tTopleveltrootttitleticonnametMessagetmessagetpacktBOTHtFrametframeR tcanceltdefaulttbindt return_eventtrangetlentButtontconfigtRIDGEtLEFTtprotocoltwm_delete_windowt_set_transient( R tmasterRtbuttonsRRRRR tstb((s+/usr/lib64/python2.7/lib-tk/SimpleDialog.pyt__init__ s.       g?g333333?c Csh|j}|j|j||j|jri|j}|j}|j}|j}n"|j }|j }d}}|j } |j } ||| |} ||| |} | | |j kr|j | } n| dkrd} n| | |j kr.|j | } n| dkrCd} n|j d| | f|jdS(Nis+%d+%d(Rtwithdrawt transienttupdate_idletaskstwinfo_ismappedt winfo_widtht winfo_heightt winfo_rootxt winfo_rootytwinfo_screenwidthtwinfo_screenheighttwinfo_reqwidthtwinfo_reqheighttgeometryt deiconify( R R(trelxtrelytwidgettm_widthtm_heighttm_xtm_ytw_widthtw_heighttxty((s+/usr/lib64/python2.7/lib-tk/SimpleDialog.pyR'%s4                 cCs;|jj|jj|jj|jj|jS(N(Rtwait_visibilitytgrab_settmainlooptdestroyR (R ((s+/usr/lib64/python2.7/lib-tk/SimpleDialog.pytgoBs     cCs3|jdkr|jjn|j|jdS(N(RtNoneRtbellR (R tevent((s+/usr/lib64/python2.7/lib-tk/SimpleDialog.pyRIscCs3|jdkr|jjn|j|jdS(N(RRKRRLR (R ((s+/usr/lib64/python2.7/lib-tk/SimpleDialog.pyR&OscCs||_|jjdS(N(R Rtquit(R R ((s+/usr/lib64/python2.7/lib-tk/SimpleDialog.pyR Us N( t__name__t __module__RKR,R'RJRR&R (((s+/usr/lib64/python2.7/lib-tk/SimpleDialog.pyRs    t__main__cCsjt}|d}t|ddd|}|jt|ddd|j}|j|jdS(Nc SsBt|ddddddgddd d d d }|jGHdS( NRsThis is a test dialog. Would this have been an actual dialog, the buttons below would have been glowing in soft pink light. Do you believe this?R)tYestNotCancelRiRiRs Test Dialog(RRJ(Rtd((s+/usr/lib64/python2.7/lib-tk/SimpleDialog.pytdoit^s  RtTestRtQuit(tTkR!RRNRH(RRVtttq((s+/usr/lib64/python2.7/lib-tk/SimpleDialog.pyttest\s    N((t__doc__tTkinterRROR\(((s+/usr/lib64/python2.7/lib-tk/SimpleDialog.pyts  S