Afc@s0ddlZddlZddlTddlmZddlmZddlmZddl Z ddl Z ej Z dej e krdGHdGe GHejnd Zd Zd Zd Zd ZddefZdZd ZdZd!d"d#fZdefdYZdZedkr,endS($iN(t*(t Percolator(tColorDelegator(t view_files turtleDemo.pys:Directory of turtleDemo must be current working directory!sBut in your case this isiiiiitAriali tboldsLucida ConsoleitnormalcCsgtjtD]+}|jdr|jd r|^q}g}x|D]}|jdrs|j|qNtjjt|}tjj||g}gtj|D]*}|jdr|jdr|^q}|j||qNW|S(Nttdemo_s.pycs.py( tostlistdirtdemo_dirt startswithtendswithtappendtpathtjointsys(tentrytentries1tentries2Rtsubdirtscripttscripts((s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pytgetExampleEntriess  sTurtledemo helps demohelp.txtsAbout turtledemosabout_turtledemo.txtsAbout turtle modulesabout_turtle.txtt DemoWindowcBseZddZdZdZdZdddZdZdZ d Z d Z d Z d Z d ZdZRS(cCst|_}t_|jd|jd|j|jddd|jddd|jddddd|jddddd|jd ddddt |d t d d|_ |j |_ |j|_|j jd dd dddtdtdddtdd}|j|j||j|j||jd dd dddt|dddddddd,d dd t|_t|dddtd d!d"d#d$|j|_t|dd%dtd d!d"d#d$|j|_t|dd&dtd d!d"d#d$|j |_!|jjd dd'dddd(d-|jjd dd'ddd)|jjd dd'ddd)|j!jd dd'd dd)t"|j#j$t%t&|_'t&|_(|r|j)|n|j*t+t,t,t,d*d+t-|_.dS(.NsPython turtle-graphics examplestWM_DELETE_WINDOWitweightitminsizeiZiitrelieft borderwidthtrowt columnspanitstickytnewstorientt sashwidthit sashrelieftbgs#dddtheightttexts --- s#ddftfontRiRs START tfgtwhitetdisabledforegrounds#fedtcommands STOP s CLEAR tcolumntpadxtewsChoose example from menutblack(RiR(ii(/tTktroottturtlet_rootttitlet wm_protocolt_destroytgrid_rowconfiguretgrid_columnconfiguretFrametRAISEDtmBartmakeLoadDemoMenut ExamplesBtnt makeHelpMenut OptionsBtntgridt PanedWindowt HORIZONTALtSOLIDtaddt makeTextFrametmakeGraphFrametLabeltRIDGEt output_lbltButtontbtnfontt startDemot start_btntstopIttstop_btnt clearCanvast clear_btnRR't insertfilterRtFalsetdirtytexitflagtloadfilet configGUItNORMALtDISABLEDtSTARTUPtstate(tselftfilenameR2tpane((s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyt__init__7sR      %   cCsf|jj}|jj}|jjd|j||j|jjd|j||jdS(Ng?(t_canvast winfo_widtht winfo_heightt xview_movetot canvwidtht yview_movetot canvheight(R]teventtcwidthtcheight((s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pytonResizehs"c Cst||_}t|dddddddd|_}t|dd |_}|j|d <|jd td t t|dd dt |_ }|j |d <|jd t d tt|d<|j|d<|j|d<|jd td tdd|S(NtnameR'R.itwraptnonetwidthi-tvbarR,tsidetfillthbarR"R(tyscrollcommandtxscrollcommandtexpandi(R:t text_frametTextR't ScrollbarRptyviewtpacktLEFTtYRCRstxviewtBOTTOMtXttxtfonttsettBOTH(R]R2RwR'RpRs((s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyRFns     cCs|tj_d|_d|_tj|dd|j|jtj_|_}|j|jj d|j d|jdiR(R3t_ScreenR4ReRgtScrolledCanvasRat adjustScrollst _rootwindowtbindRktScreentscreent TurtleScreenR`tscanvast RawTurtletscreens(R]R2tcanvast_s_((s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyRGs   ,   ttbluecCs|jjd||jjd|d|tkr7dnd|jjd|d|tkrbdnd|jjd|d|tkrdnd|jjd|d|dS(NR\R%s#d00s#fcaR'R)(R>tconfigRNRYRPRRRJ(R]tmenutstarttstoptclearttxttcolor((s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyRXscsftjdddddt}|jdtddt||_x tD]}fd }t|t r|jj d |d d !dddtd ||qP|d|d}}t|j|j_ xR|D]J}|jj j d |d d !dddtd |t j j||qW|jjd |d d|jj dtqPW|j|d<|S(NR'tExamplest underlineiR(RqR.t2mcsfd}|S(NcsjdS(N(RW((R]tx(s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pytemits((RR(R](Rs./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyt loadexamplestlabeliiR,iR(t MenubuttonR<tmenufontR{R|tMenuRRt isinstancetstrt add_commandtchoicesRRRt add_cascade(R]tCmdBtnRRt_dirtentrieste((R]s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyR=s(   ! cstjdddddt}|jdtddt||_xHtD]@\}}||fd }|jjd |dtd |qMW|j|d <|S( NR'tHelpRiR(RqR.Rcs&tj|tjjt|dS(N(RR2RRRR (t help_labelt help_file(R](s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pytshowsRR,R( RR<RR{R|RRt help_entriesR(R]RRRR((R]s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyR?s!# cCs'|js dS|jjt|_dS(N(RURRRT(R]((s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyt refreshCanvass  cCs|jtjj|rtjj| rt|d}|j}|j|jj dd|jj d|tjj |\}}|j j |dd!dt|d |_|jttttddt|_ndS( Ntrs1.0tendiis# - a Python turtle graphics examplesPress start buttontred(RRRtexiststisdirtopentreadtcloseR'tdeletetinserttsplitR2R5t __import__tmoduleRXRYRZtREADYR\(R]R^tftcharstdirectfname((s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyRWs %   cCs4|jt|_ttj_|jttttdd|j j |j j dt |_ y4|jj}|dkrt|_ n t|_ Wn6tjk r|jdkrdSt|_ d}nX|j tkr|jtttt|n7|j tkr0t|_|jttttddndS(Nsdemo running...R0tstandardt EVENTLOOPsstopped!suse mouse/keys or STOPR(RtTrueRUR3Rt_RUNNINGRXRZRYRRtmodetRUNNINGR\Rtmaint EVENTDRIVENtDONEt TerminatorR2tNoneRV(R]tresult((s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyRMs2             cCs7|j|jjdd|jttttdS(NtcursorR(RRRRXRYRZ(R]((s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyRQs cCsW|jrG|jt|_|jttttddttj_n ttj_dS(NsSTOPPED!R( RVRQRTRXRYRZR3RR(R]((s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyROs    cCs&ttj_|jjd|_dS(N(RTR3RRR2tdestroyR(R]((s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyR7s  N(t__name__t __module__RR`RkRFRGRXR=R?RRWRMRQROR7(((s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyR5s 1         cCst}|jjdS(N(RR2tmainloop(tdemo((s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyR s t__main__(Ri R(sLucida ConsoleiR(sTurtledemo helps demohelp.txt(sAbout turtledemosabout_turtledemo.txt(sAbout turtle modulesabout_turtle.txt(RRtTkintertidlelib.PercolatorRtidlelib.ColorDelegatorRtidlelib.textViewRR3ttimetgetcwdR R texitR[RRRRRYRRLRRRtobjectRRR(((s./usr/lib64/python2.7/Demo/turtle/turtleDemo.pyts8