python (3.11.7)

(root)/
lib/
python3.11/
turtledemo/
__pycache__/
__main__.cpython-311.opt-1.pyc

e;~dZddlZddlZddlTddlmZmZddlmZddl	m
Z
ddlmZddl
Z
ejejeZejdkZd	Zd
ZdZdZd
ZddefZdZgdZdZdZgdZ dZ!defdefde
jffZ"Gdde#Z$dZ%e&dkre%dSdS)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__darwinArial)rrbold)zLucida Console
normald)	rrcHdtjtDS)Ncdg|]-}|dr|ddk#|dd.S)z.pyr_N)endswith).0entrys  G/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/turtledemo/__main__.py
<listcomp>z%getExampleEntries.<locals>.<listcomp>usH7775NN5!!7&+Ah#oo
#2#J&5oo)oslistdirdemo_dirr(r&getExampleEntriesr-ts,77BJx$8$87777r(zTurtledemo helpzAbout turtledemozAbout turtle moduleceZdZddZdZdZdZdZddZddZ	d	Z
ddZd
ZdZ
dZdZdZdZdZdZdZdS)
DemoWindowNc
tx|_x}t_|d|d|jtrQddl}|	ddddd
tjddg|j
|j
	|dd
|dd
|d
dd

|ddd

|ddd

t!|t"d|_|j||jdd|j||jdd|j||jdd|j|d<t/|t0dt2d}|||||||dddt=|d
ddddt>|_ trjtC|d tDd!|j#"|_$tC|d#tDd!|j%"|_&tC|d$tDd!|j'"|_(nltC|d tDd%d&|j#'|_$tC|d#tDd%d&|j%'|_&tC|d$tDd%d&|j''|_(|j d
ddd()|j$d
d
d*+|j&d
dd*+|j(d
dd*+tS|j*+tYd,|_-d,|_.|r|/||0tbtbtbd-d.td|_3dS)/NzPython turtle-graphics examplesWM_DELETE_WINDOWr	osascriptz-ez tell application "System Events"z>set frontmost of the first process whose unix id is {} to truezend tell)stderrstdoutr
)weightZ)minsizer5rr)reliefborderwidthExamples)menulabel	underlineFontsizeHelpr;rz#ddd)orient	sashwidth
sashreliefbgr
news)row
columnspanstickyz --- z#ddf)rr)heighttextrCfontr9r8z START z#00cc22)rJrKfgcommandz STOP z CLEAR whitez#fed)rJrKrLdisabledforegroundrM)rr)rEcolumnrGpadxew)rErPrGFzChoose example from menublack)4Tkrootturtle_roottitlewm_protocol_destroyr	
subprocessrunformatr)getpidDEVNULLgrid_rowconfiguregrid_columnconfigureMenuRAISEDmBaradd_cascademakeLoadDemoMenumakeFontMenumakeHelpMenuPanedWindow
HORIZONTALSOLIDadd
makeTextFramemakeGraphFramegridLabelRIDGE
output_lblButtonbtnfont	startDemo	start_btnstopItstop_btnclearCanvas	clear_btnrrJinsertfilterrdirtyexitflagloadfile	configGUIDISABLEDSTARTUPstate)selffilenamerUr[panes     r&__init__zDemoWindow.__init__s*,$$.	.D6<

4555+T];;;
	0
NN#@66<fRY[[6I6Ij&-%-
	
0	
0	
0	
q+++!!!A!...!!!R!:::!!!R!:::!!!R!:::f!<<<		4#8#8#C#C$.!		=	=	=	4#4#4TY#?#?$.!		=	=	=	4#4#4TY#?#?$*a		9	9	9yV4
a&+888##D))***$$T**+++		aAf	555ag&%<!',...	@#Dyw'0$.JJJDN"4hW&/FFFDM#Dyw'0D<LNNNDNN$Dyw'.V,0N<<<DN#4hW&-F+/;888DM$Dyw'.6.2.>@@@DN	
1V%HHH!D999
q4888!D99949**>+;+;<<<

	$MM(###x817	<	<	<


r(c|j}|j}|jd|j|z
z|jz|jd|j|z
z|jzdS)Ng?)canvaswinfo_widthwinfo_heightxview_moveto	canvwidthyview_moveto
canvheight)reventcwidthcheights    r&onResizezDemoWindow.onResizes((**+**,,  dnV&;!<T^!KLLL  dog&=!>t!NOOOOOr(ct|x|_}t|ddddx|_}t	|t|dx|_}|j|d<|tt	t|d
tx|_}|j
|d<|tt	|j|d<|j|d
<t#t$|d<t&rdnd}|d|z|j|d|z|j|d|z|j|d|z|j|d|j|d|j|d|j|tt2d|S)NrJrnone-)namerQwrapwidthvbar)rrM)sidefillhbar)rr@yscrollcommandxscrollcommandrKCommandControlz
<%s-minus>z<%s-underscore>z
<%s-equal>z	<%s-plus>z<Control-MouseWheel>z<Control-Button-4>z<Control-Button-5>r
)rrexpand)Frame
text_frameTextrJr	ScrollbarryviewpackLEFTYrjrxviewBOTTOMXsettupletxtfontr	bind_all
decrease_size
increase_sizebindupdate_mousewheelBOTH)rrUrrJrrshortcuts       r&rmzDemoWindow.makeTextFrames',T{{2*
a%+2777	7	DT$Zf====	D*Y		t!	$$$$ZfZPPPP	D*Y		vA	&&&!%
!%
W~~V &599I

lX-t/ABBB

'(2D4FGGG

lX-t/ABBB

kH,d.@AAA		($*@AAA		&(:;;;		&(:;;;		t$q	111r(c|tj_d|_d|_tj|dd|j|jxtj_x|_}||j	
d|jd|jd<tjx|_
}tj|||gtj_|S)Nii iXz<Configure>rr9)rV_ScreenrWrrScrolledCanvas_canvasr
adjustScrolls_rootwindowrrScreenscreenTurtleScreenr	RawTurtlescreens)rrUrrs    r&rnzDemoWindow.makeGraphFrames
 $8>8Mc39A9A	A	Av
t}===()}%%}.f$$VV444$*8 
r(cl|td<tt|jd<d|z|jd<dS)Nr
rKzFont size %drJ)rrrJrr)rsizes  r&set_txtsizezDemoWindow.set_txtsizes4
!'NN	&"04"7r(cr|ttddz
tdSNr
break)rmaxrMINIMUM_FONT_SIZErdummys  r&rzDemoWindow.decrease_size.WQZ!^->??@@@wr(cr|ttddztdSr)rminrMAXIMUM_FONT_SIZErs  r&rzDemoWindow.increase_sizerr(c||jdktkr|S|S)Nr)deltar	rr)rrs  r&rzDemoWindow.update_mousewheels;
K!OV,,%%'''%%'''r(bluectrR|j||j||j|n{|j||t
krdnd|j||t
krdnd|j||t
krdnd|j||dS)N)rz#d00z#fca)rrC)rJrL)r	rvconfigrxrzNORMALrr)rstartstopcleartxtcolors      r&rzDemoWindow.configGUIs
	LN!!!...M  t ,,,N!!!....N!!/4VVF
"
L
L
LM  t.2fnnFF&
!
J
J
JN!!/4VVF
"
L
L
LCE22222r(ct|}tD]'}|ffd	}||dt|(|S)Nc2|dSN)r~)r%rs r&loadz)DemoWindow.makeLoadDemoMenu.<locals>.load*s

e$$$$$r(rr<r=rKrM)rbr-add_commandmenufont)rmasterr;r%rs`    r&rfzDemoWindow.makeLoadDemoMenu&stF||&((	:	:E 
%
%
%
%
%
%5A"*D

:
:
:
:r(cNt|}|djt|djt|tD]4}|ffd	}|t|dt|5|S)NzDecrease (C-'-'))r<rMrKzIncrease (C-'+')c2|dSr)r)rrs r&resizez'DemoWindow.makeFontMenu.<locals>.resize9s  &&&&&r(rr)rbrrrr
add_separator
font_sizesstr)rrr;rrs`    r&rgzDemoWindow.makeFontMenu0sF||14;M&		(	(	(14;M&		(	(	(	<	<D 
'
'
'
'
'
'3t99"*F

<
<
<
<r(ct|}tD]*\}}||ffd	}||t|+|S)Nc4tj||dSr)rrU)
help_label	help_filers  r&showz%DemoWindow.makeHelpMenu.<locals>.showCs$)Z;;;;;r()r<rKrM)rbhelp_entriesrr)rrr;rrrs`     r&rhzDemoWindow.makeHelpMenu?sjF||%1	L	L!J	 *i
<
<
<
<
<
<:HdKKKKr(cX|jr"|jd|_dSdSNF)r|rrrs r&
refreshCanvaszDemoWindow.refreshCanvasHs5:	KDJJJ		r(c@|dtj_d|z}t	|t
j||_t|jj	d5}|
}dddn#1swxYwY|jdd|j
d||j|dz|t"t$t$ddt&|_dS)	NFzturtledemo.rz1.0endz# - a Python turtle graphics examplezPress start buttonred)ryrVr_RUNNING
__import__sysmodulesmoduleopen__file__readrJdeleteinsertrUrXrrrREADYr)rrmodnamefcharss     r&r~zDemoWindow.loadfileMs/',$(*7k'*
$+&
,
,	FFHHE																&&&	&&&	#HHIIIvx+U	4	4	4


s+BBBc|d|_dtj_|tttdd|j	|j
dt|_	|j
}|dkr
t|_nt |_n-#tj$r|jYdSt |_d}YnwxYw|jt kr)|ttt|dS|jtkr1d|_|tttdddSdS)	NTzdemo running...rSstandard	EVENTLOOPzstopped!zuse mouse/keys or STOPr)rr|rVrrrrrrrmodeRUNNINGrrmainEVENTDRIVENDONE
TerminatorrUr})rresults  r&ruzDemoWindow.startDemo\sh
'+$x('	3	3	3$$$

	 [%%''F$$(

!
 	 	 	 y DJFFF		 
:NN68V!
#
#
#
#
#
Z;
&
& DMNN8VX3U
<
<
<
<
<'
&s8CC8'C87C8c||jd|jd|tttdS)Nallr)cursor)rr_deleterrrrrrs r&ryzDemoWindow.clearCanvasys_E""""%%%vx22222r(c|jrC|d|_|tttdddt
j_dS)NFzSTOPPED!r)r}ryrrrrVrrrs r&rwzDemoWindow.stopItsW=	.!DMNN68X%u
.
.
.',$$$r(chdtj_|jd|_dSr)rVrrrUdestroyrs r&rZzDemoWindow._destroys,',$				r(r)rr)__name__
__module____qualname__rrrmrnrrrrrrfrgrhrr~ruryrwrZr,r(r&r/r/s>IIIIXPPP8(888
(((3333






<<<:333---r(r/cTt}|jdSr)r/rUmainloop)demos r&rrs%<<DIr(__main__)'rrr)tkinteridlelib.colorizerrridlelib.percolatorridlelib.textviewr
turtledemoabout_turtledemorVpathdirnameabspathrr+platformr	rrr
r
rrrrtrrrrr-robjectr/rrr,r(r&<module>r)sTTj


				::::::::))))))&&&&&&222222




7??27??84455		!
	
R 

*
*
*
7
7
7
777
 )*FN+KKKKKKKK\zDFFFFFr(