Ë c‡½j<ãó¼—dZddlZddlZddl­ddlmZmZddlmZddl m Z ddl Z ddl mZ ejdk(r dd lmZe«ej"j%ej"j'e««Zejd k(Zd Zd Zd ZdZdZddefZdZgd¢ZdZ dZ!gd¢Z"d„Z#defde fde jffZ$Gd„de%«Z&d„Z'e(dk(re'«yy)a˜ ---------------------------------------------- turtleDemo - Help ---------------------------------------------- This document has two sections: (1) How to use the demo viewer (2) How to add your own demos to the demo repository (1) How to use the demo viewer. Select a demoscript from the example menu. The (syntax colored) source code appears in the left source code window. IT CANNOT BE EDITED, but ONLY VIEWED! The demo viewer windows can be resized. The divider between text and canvas can be moved by grabbing it with the mouse. The text font size can be changed from the menu and with Control/Command '-'/'+'. It can also be changed on most systems with Control-mousewheel when the mouse is over the text. Press START button to start the demo. Stop execution by pressing the STOP button. Clear screen by pressing the CLEAR button. Restart by pressing the START button again. SPECIAL demos, such as clock.py are those which run EVENTDRIVEN. Press START button to start the demo. - Until the EVENTLOOP is entered everything works as in an ordinary demo script. - When the EVENTLOOP is entered, you control the application by using the mouse and/or keys (or it's controlled by some timer events) To stop it you can and must press the STOP button. While the EVENTLOOP is running, the examples menu is disabled. - Only after having pressed the STOP button, you may restart it or choose another example script. * * * * * * * * In some rare situations there may occur interferences/conflicts between events concerning the demo script and those concerning the demo-viewer. (They run in the same process.) Strange behaviour may be the consequence and in the worst case you must close and restart the viewer. * * * * * * * * (2) How to add your own demos to the demo repository - Place the file in the same directory as turtledemo/__main__.py IMPORTANT! When imported, the demo should not modify the system by calling functions in other modules, such as sys, tkinter, or turtle. Global variables should be initialized in main(). - The code must contain a main() function which will be executed by the viewer (see provided example scripts). It may return a string which will be displayed in the Label below the source code window (when execution has finished.) - In order to run mydemo.py by itself, such as during development, add the following at the end of the file: if __name__ == '__main__': main() mainloop() # keep window open python -m turtledemo.mydemo # will then run it - If the demo is EVENT DRIVEN, main must return the string "EVENTLOOP". This informs the demo viewer that the script is still running and must be stopped by the user! If an "EVENTLOOP" demo runs by itself, as with clock, which uses ontimer, or minimal_hanoi, which loops by recursion, then the code should catch the turtle.Terminator exception that will be raised when the user presses the STOP button. (Paint is not such a demo; it only acts in response to mouse clicks and movements.) éN)Ú*)ÚColorDelegatorÚ color_config)Ú Percolator)Ú view_text)Ú__doc__Úwin32)Ú fix_win_hidpiÚdarwinéééééÚArialé )rrÚbold)zLucida Consoleé Únormalééd) éé ré réééééécó’—tjt«D�cgc] }|jd«r |ddk7r|dd‘Œ"c}Scc}w)Nz.pyrÚ_éýÿÿÿ)ÚosÚlistdirÚdemo_dirÚendswith)Úentrys ú,/usr/lib64/python3.12/turtledemo/__main__.pyÚgetExampleEntriesr*vsL€Ü$&§J¡J¬xÔ$8ó 7Ñ$8˜5Ø �N‰N˜5Ô ! e¨A¡h°#¢oð �#�2ŠJÐ$8ñ 7ð7ùò 7sœ%AzTurtledemo helpzAbout turtledemozAbout turtle modulecó€—eZdZdd„Zd„Zd„Zd„Zd„Zdd„Zdd„Z d „Z dd „Z d „Z d „Z d „Zd„Zd„Zd„Zd„Zd„Zd„Zy)Ú DemoWindowNc óN—t«x|_x}t_|j d«|j d|j «trTddl}|jdddddjtj««ddg|j|j¬ «|jdd ¬ «|jdd ¬ «|jd d d ¬ «|jdd d ¬ «|jdd d ¬ «t!|t"d¬«|_|j$j'|j)|j$«dd¬«|j$j'|j+|j$«dd¬«|j$j'|j-|j$«dd¬«|j$|d<t/|t0dt2d¬«}|j5|j7|««|j5|j9|««|j;ddd¬«t=|d ddddt>¬«|_ trjtC|d tDd!|jF¬"«|_$tC|d#tDd!|jJ¬"«|_&tC|d$tDd!|jN¬"«|_(nltC|d tDd%d&|jF¬'«|_$tC|d#tDd%d&|jJ¬'«|_&tC|d$tDd%d&|jN¬'«|_(|j@j;d ddd(¬)«|jHj;d d d*¬+«|jLj;d dd*¬+«|jPj;d dd*¬+«tS|jT«jWtY««d,|_-d,|_.|r|j_|«|jatbtbtbd-d.«td|_3y)/NzPython turtle-graphics examplesÚWM_DELETE_WINDOWrz/usr/bin/osascriptz-ez tell application "System Events"z>set frontmost of the first process whose unix id is {} to truezend tell)ÚstderrÚstdoutr )ÚweightéZ)Úminsizer1r r)ÚreliefÚ borderwidthÚExamples)ÚmenuÚlabelÚ underlineÚFontsizeÚHelpr7rz#ddd)ÚorientÚ sashwidthÚ sashreliefÚbgrÚnews)ÚrowÚ columnspanÚstickyz --- z#ddf)rér)ÚheightÚtextr?Úfontr5r4z START z#00cc22)rFrGÚfgÚcommandz STOP z CLEAR Úwhitez#fed)rFrGrHÚdisabledforegroundrI)rr)rAÚcolumnrCÚpadxÚew)rArLrCFzChoose example from menuÚblack)4ÚTkÚrootÚturtleÚ_rootÚtitleÚ wm_protocolÚ_destroyr Ú subprocessÚrunÚformatr$ÚgetpidÚDEVNULLÚgrid_rowconfigureÚgrid_columnconfigureÚMenuÚRAISEDÚmBarÚ add_cascadeÚmakeLoadDemoMenuÚ makeFontMenuÚ makeHelpMenuÚ PanedWindowÚ HORIZONTALÚSOLIDÚaddÚ makeTextFrameÚmakeGraphFrameÚgridÚLabelÚRIDGEÚ output_lblÚButtonÚbtnfontÚ startDemoÚ start_btnÚstopItÚstop_btnÚ clearCanvasÚ clear_btnrrFÚ insertfilterrÚdirtyÚexitflagÚloadfileÚ configGUIÚDISABLEDÚSTARTUPÚstate)ÚselfÚfilenamerQrWÚpanes r)Ú__init__zDemoWindow.__init__ƒsˆ€Ü*,«$Ð.ˆŒ Ð.�Dœ6œ<Ø � ‰ Ð4Ô5Ø ×ÑÐ+¨T¯]©]Ô;å Û ð �N‰Nà,ØÐ@Øð6ß6<±f¼R¿Y¹Y»[Ó6Iؘjð ð&×-Ñ-Ø%×-Ñ-ð ô 0ð ×јq¨ÐÔ+Ø ×!Ñ! !¨AÐ!Ô.Ø ×!Ñ! !¨R¸Ð!Ô:Ø ×!Ñ! !¨R¸Ð!Ô:Ø ×!Ñ! !¨R¸Ð!Ô:䘤f¸!Ô<ˆŒ Ø � ‰ ×Ñ 4×#8Ñ#8¸¿¹Ó#CØ$.¸!ð ô =à � ‰ ×Ñ 4×#4Ñ#4°T·Y±YÓ#?Ø$.¸!ð ô =à � ‰ ×Ñ 4×#4Ñ#4°T·Y±YÓ#?Ø$*°að ô 9à—y‘yˆˆV‰ ä˜4¬ ¸aÜ&+°ô8ˆà �‰�×#Ñ# DÓ)Ô*Ø �‰�×$Ñ$ TÓ*Ô+Ø � ‰ �a A¨fˆ Ô5ä ¨a°gÀ&Ø%<È!Ü',ô.ˆŒõ Ü# D¨y¼wØ'0¸$¿.¹.ôJˆDŒNä" 4¨h¼WØ&/¸¿¹ôFˆDŒMä# D¨y¼wØ'0¸D×Ñ.>ô@ˆDŒNð �‰×Ñ ¨1°VÀ%ÐÔHØ �‰×Ñ ¨!°DÐÔ9Ø � ‰ ×јq¨°4ÐÔ8Ø �‰×Ñ ¨!°DÐÔ9ä�4—9‘9Ó×*Ñ*¬>Ó+;Ô<؈Œ ؈Œ Ù Ø �M‰M˜(Ô #Ø �‰”x¤¬8Ø1°7ô <äˆ� ócóL—|jj«}|jj«}|jjd|j|z z|jz «|jj d|j |z z|j z «y)Ngà?)ÚcanvasÚ winfo_widthÚ winfo_heightÚ xview_movetoÚ canvwidthÚ yview_movetoÚ canvheight)rÚeventÚcwidthÚcheights r)ÚonResizezDemoWindow.onResizeÏsx€Ø—‘×(Ñ(Ó*ˆØ—+‘+×*Ñ*Ó,ˆØ � ‰ × Ñ   d§n¡n°VÑ&;Ñ!<¸T¿^¹^Ñ!KÔLØ � ‰ × Ñ   d§o¡o°gÑ&=Ñ!>¸t¿¹Ñ!NÕOrƒcó¼—t|«x|_}t|dddd¬«x|_}t |«t |d¬«x|_}|j|d<|jtt¬ «t |d t¬ «x|_ }|j|d<|jtt¬ «|j |d <|j |d <t#t$«|d<t&rdnd}|j)d|z|j*«|j)d|z|j*«|j)d|z|j,«|j)d|z|j,«|j/d|j0«|j/d|j,«|j/d|j*«|jtt2d¬«|S)NrFrÚnoneé-)ÚnamerMÚwrapÚwidthÚvbar)r“rI)ÚsideÚfillÚhbar)r“r<ÚyscrollcommandÚxscrollcommandrGÚCommandÚControlz <%s-minus>z<%s-underscore>z <%s-equal>z <%s-plus>zzzr )r—r˜Úexpand)ÚFrameÚ text_frameÚTextrFrÚ Scrollbarr–ÚyviewÚpackÚLEFTÚYrfr™ÚxviewÚBOTTOMÚXÚsetÚtupleÚtxtfontr Úbind_allÚ decrease_sizeÚ increase_sizeÚbindÚupdate_mousewheelÚBOTH)rrQr rFr–r™Úshortcuts r)rizDemoWindow.makeTextFrameÕsŠ€Ü',¨T£{Ð2ˆŒ˜*Ü  °¸aØ%+°2ô7ð 7ˆŒ �Dä�TÔä$ Z°fÔ=Ð=ˆŒ �DØŸ*™*ˆˆY‰Ø � ‰ ”t¤!ˆ Ô$Ü$ Z°fÄZÔPÐPˆŒ �DØŸ*™*ˆˆY‰Ø � ‰ ”v¤Aˆ Ô&Ø!%§¡ˆÐ ÑØ!%§¡ˆÐ ÑäœW“~ˆˆV‰ Ý &‘9¨IˆØ � ‰ �l XÑ-¨t×/AÑ/AÔBØ � ‰ Ð'¨(Ñ2°D×4FÑ4FÔGØ � ‰ �l XÑ-¨t×/AÑ/AÔBØ � ‰ �k HÑ,¨d×.@Ñ.@ÔAØ � ‰ Ð(¨$×*@Ñ*@ÔAØ � ‰ Ð&¨×(:Ñ(:Ô;Ø � ‰ Ð&¨×(:Ñ(:Ô;à � ‰ ”t¤$¨qˆ Ô1ØÐrƒcó —|tj_d|_d|_tj |dd|j|j«xtj_x|_}|j«|jjd|j«d|j d<tj«x|_ }tjj||«|gtj _|S)Nièi iXz rr5)rRÚ_ScreenrSr‰r‹ÚScrolledCanvasÚ_canvasr…Ú adjustScrollsÚ _rootwindowr°r�ÚScreenÚscreenÚ TurtleScreenr‚Ú RawTurtleÚscreens)rrQr…r»s r)rjzDemoWindow.makeGraphFrameñsÌ€ð $Œ�‰ÔàˆŒØˆŒÜ8>×8MÑ8MØ�c˜3 §¡°·±ó9Að AŒ�‰Ôð A ¤¨và×ÑÔØ×Ñ×Ñ  ¨t¯}©}Ô=Ø()ˆ�‰�}Ñ%ä%Ÿ}™}›Ð.ˆŒ �fÜ×Ñ×$Ñ$ V¨VÔ4Ø$* 8Œ×ÑÔ Øˆ rƒcór—|td<tt«|jd<d|z|jd<y)Nr rGz Font size %drF)r¬r«rFrn)rÚsizes r)Ú set_txtsizezDemoWindow.set_txtsizes0€ØŒ�‰ Ü!¤'›Nˆ� ‰ �&ÑØ"0°4Ñ"7ˆ�‰˜ÒrƒcóV—|jttddz t««y©Nr Úbreak)rÁÚmaxr¬ÚMINIMUM_FONT_SIZE©rÚdummys r)r®zDemoWindow.decrease_size ó#€Ø ×ÑœœW Q™Z¨!™^Ô->Ó?Ô@ØrƒcóV—|jttddzt««yrÃ)rÁÚminr¬ÚMAXIMUM_FONT_SIZErÇs r)r¯zDemoWindow.increase_sizerÉrƒcóp—|jdkt k(r|j«S|j«S)Nr)Údeltar r®r¯)rrŒs r)r±zDemoWindow.update_mousewheels4€ð �K‰K˜!‰O¤V Ò ,Ø×%Ñ%Ó'Ð 'à×%Ñ%Ó'Ð 'rƒcóä—trU|jj|¬«|jj|¬«|jj|¬«nx|jj||t k(rdnd¬«|jj||t k(rdnd¬«|jj||t k(rdnd¬«|j j||¬«y)N)r~z#d00z#fca)r~r?)rFrH)r rrÚconfigrtrvÚNORMALrn)rÚstartÚstopÚclearÚtxtÚcolors r)r{zDemoWindow.configGUIsÊ€Ý Ø �N‰N× !Ñ !¨Ð !Ô .Ø �M‰M× Ñ  tÐ Ô ,Ø �N‰N× !Ñ !¨Ð !Õ .à �N‰N× !Ñ !¨Ø/4¼ª¡VÀFð "ô Là �M‰M× Ñ  tØ.2´fªn¡FÀ&ð !ô Jà �N‰N× !Ñ !¨Ø/4¼ª¡VÀFð "ô Là �‰×Ñ C¨EÐÕ2rƒcó|‡—t|«}t«D]"}|fˆfd„ }|j|dt|¬«Œ$|S)Ncó(•—‰j|«y©N)rz)r(rs €r)Úloadz)DemoWindow.makeLoadDemoMenu..load,sø€Ø— ‘ ˜eÕ$rƒr©r8r9rGrI)r^r*Ú add_commandÚmenufont)rÚmasterr7r(rÚs` r)rbzDemoWindow.makeLoadDemoMenu(sDø€Ü�F‹|ˆä&Ö(ˆEØ õ %à × Ñ  5°AÜ"*°Dð õ :ð)ð ˆ rƒcó.‡—t|«}|jd‰jt¬«|jd‰jt¬«|j «t D]+}|fˆfd„ }|jt|«dt|¬«Œ-|S)NzDecrease (C-'-'))r8rIrGzIncrease (C-'+')có(•—‰j|«yrÙ)rÁ)rÀrs €r)Úresizez'DemoWindow.makeFontMenu..resize;sø€Ø× Ñ  Õ&rƒrrÛ)r^rÜr®rÝr¯Ú add_separatorÚ font_sizesÚstr)rrÞr7rÀrás` r)rczDemoWindow.makeFontMenu2s“ø€Ü�F‹|ˆØ ×ÑÐ1¸4×;MÑ;MÜ&ð ô (à ×ÑÐ1¸4×;MÑ;MÜ&ð ô (à ×ÑÔçˆDØ õ 'à × Ñ ¤3 t£9¸Ü"*°Fð õ <ðð ˆ rƒcóz‡—t|«}tD]%\}}||fˆfd„ }|j|t|¬«Œ'|S)Ncó4•—t‰j||«yrÙ)rrQ)Ú help_labelÚ help_filers €r)Úshowz%DemoWindow.makeHelpMenu..showEsø€Ü˜$Ÿ)™) Z°Õ;rƒ)r8rGrI)r^Ú help_entriesrÜrÝ)rrÞr7rçrèrés` r)rdzDemoWindow.makeHelpMenuAsAø€Ü�F‹|ˆç%1Ñ !ˆJ˜ Ø *°iõ <à × Ñ  :´HÀdÐ Õ Kð&2ðˆ rƒcó`—|jr"|jj«d|_yy©NF)rxr»rÔ©rs r)Ú refreshCanvaszDemoWindow.refreshCanvasJs%€Ø �:Š:Ø �K‰K× Ñ Ô ØˆD�Jð rƒcó,—|j«dtj_d|z}t |«t j ||_t|jjd«5}|j«}ddd«|jjdd«|jjd«|jj|dz«|j!t"t$t$dd«t&|_y#1swYŒŒxYw) NFz turtledemo.Úrz1.0Úendz# - a Python turtle graphics examplezPress start buttonÚred)rurRr¼Ú_RUNNINGÚ __import__ÚsysÚmodulesÚmoduleÚopenÚ__file__ÚreadrFÚdeleteÚinsertrQrTr{rÑr|ÚREADYr~)rr€ÚmodnameÚfÚcharss r)rzzDemoWindow.loadfileOsÉ€Ø ×ÑÔØ',Œ×ÑÔ$Ø (Ñ*ˆÜ�7ÔÜ—k‘k 'Ñ*ˆŒ Ü �$—+‘+×&Ñ&¨Ô ,°Ø—F‘F“HˆE÷-à � ‰ ×ј Ô&Ø � ‰ ×ј Ô&Ø � ‰ �‰˜Ð#HÑHÔIØ �‰”vœx¬Ø+¨Uô 4äˆ� ÷-Ð ,ús Á.D Ä DcóÔ—|j«d|_dtj_|j t tt dd«|jj«|jjd«t|_ |jj«}|dk(r t|_ n t |_ |jt k(r!|j tt t|«y|jtk(r)d|_|j t tt dd«yy#tj"$r|j$€Yyt |_ d}YŒ¡wxYw) NTzdemo running...rOÚstandardÚ EVENTLOOPzstopped!zuse mouse/keys or STOPrò)rîrxrRr¼rór{r|rÑr»rÔÚmodeÚRUNNINGr~r÷ÚmainÚ EVENTDRIVENÚDONEÚ TerminatorrQry)rÚresults r)rqzDemoWindow.startDemo^s€Ø ×ÑÔØˆŒ Ø'+Œ×ÑÔ$Ø �‰”x¤¬Ø(¨'ô 3à � ‰ ×ÑÔØ � ‰ ×јÔ$܈Œ ð Ø—[‘[×%Ñ%Ó'ˆFؘÒ$Ü(�• ä!�” ð �:‰:œÒ Ø �N‰Nœ6¤8¬VØ!õ #à �Z‰Zœ;Ò &Ø ˆDŒMØ �N‰Nœ8¤V¬XØ3°Uõ <ð'øô× Ñ ò Ø�y‰yÐ Ù܈DŒJØŠFð  úsÂ6D6Ä6E'Å E'Å&E'cóЗ|j«|jjd«|jj d¬«|j t tt«y)NÚallÚ)Úcursor)rîr»Ú_deleter…rÐr{rÑr|rís r)ruzDemoWindow.clearCanvas{sE€Ø ×ÑÔØ � ‰ ×јEÔ"Ø � ‰ ×Ñ "ÐÔ%Ø �‰”vœx¬Õ2rƒcó¶—|jr8|j«d|_|jtttdd«dt j _y)NFzSTOPPED!rò)ryrur{rÑr|rRr¼rórís r)rszDemoWindow.stopIt�sA€Ø �=Š=Ø × Ñ Ô Ø!ˆDŒMØ �N‰Nœ6¤8¬XØ% uô .à',Œ×ÑÕ$rƒcóp—dtj_|jj «d|_yrì)rRr¼rórQÚdestroyrís r)rVzDemoWindow._destroy‰s'€Ø',Œ×ÑÔ$Ø � ‰ ×ÑÔØˆ� rƒrÙ)r Úblue)Ú__name__Ú __module__Ú __qualname__r‚r�rirjrÁr®r¯r±r{rbrcrdrîrzrqrursrV©rƒr)r,r,�s_„óIòXPò ò8ò(8ó óò(ó 3òò òòò ò<ò:3ò -órƒr,cóL—t«}|jj«yrÙ)r,rQÚmainloop)Údemos r)rr�s€Ü ‹<€D؇I�I×ÑÕrƒÚ__main__))rrõr$ÚtkinterÚidlelib.colorizerrrÚidlelib.percolatorrÚidlelib.textviewrrRÚ turtledemoÚabout_turtledemoÚplatformÚ idlelib.utilr ÚpathÚdirnameÚabspathrùr&r r}rýrrrrÑrÝrpr¬rÆrÌrãr*rêÚobjectr,rrrrƒr)Úr(súðñTój Û äß:Ý)Ý&Û Ý2à‡<�<�7ÒÝ*Ù„Oà �7‰7�?‰?˜2Ÿ7™7Ÿ?™?¨8Ó4Ó 5€Ø �‰˜Ñ !€Ø €Ø €Ø €Ø€Ø€ à �R˜Ð €Ø €Ú *€àÐØÐÚ 7€ ò7ð ˜Ð ØÐ)Ð*ؘFŸN™NÐ+ð€ ôK�ôKò\ð ˆzÒÙ…Fðrƒ