ROOTPLOIT
Server: LiteSpeed
System: Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: niphet (1079)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //lib64/python3.8/turtledemo/__pycache__/__main__.cpython-38.pyc
U

.e7@sdZddlZddlZddlTddlmZmZddlmZddl	m
Z
ddlmZddl
Z
ejejeZejdkZd	Zd
ZdZdZd
ZddefZdZdddgZdZdZdddddddddddgZ dd Z!d!efd"efd#e
jffZ"Gd$d%d%e#Z$d&d'Z%e&d(kre%dS))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)rrZboldzLucida Console
normald	cCsddttDS)NcSs.g|]&}|dr|ddkr|ddqS)z.pyr_N)endswith).0entryr"+/usr/lib64/python3.8/turtledemo/__main__.py
<listcomp>ts
z%getExampleEntries.<locals>.<listcomp>)oslistdirdemo_dirr"r"r"r#getExampleEntriesssr(zTurtledemo helpzAbout turtledemozAbout turtle modulec@seZdZd(ddZddZddZdd	Zd
dZd)dd
Zd*ddZ	ddZ
d+ddZddZddZ
ddZddZddZd d!Zd"d#Zd$d%Zd&d'ZdS),
DemoWindowNc	CsJt|_}t_|d|d|jtrbddl}|j	ddddd
tddg|j
|j
d	|jdd
d|jdd
d|jd
dd
d
|jddd
d
|jddd
d
t|tdd|_|jj||jddd|jj||jddd|jj||jddd|j|d<ttdtdd}|||||||jddddt|d
ddddtd|_ t!|d t"d!d"|j#d#|_$t!|d$t"d!d"|j%d#|_&t!|d%t"d!d"|j'd#|_(|j jd
ddd&d'|j$jd
d
d(d)|j&jd
dd(d)|j(jd
dd(d)t)|j*+t,d*|_-d*|_.|r.|/||0t1t1t1d+d,t2|_3dS)-NzPython turtle-graphics examplesZWM_DELETE_WINDOWrZ	osascriptz-ez tell application "System Events"z>set frontmost of the first process whose unix id is {} to truezend tell)stderrstdoutr	)weightZ)Zminsizer,r
r)reliefborderwidthZExamples)menulabel	underlineZFontsizeZHelpr0r
z#ddd)orientZ	sashwidthZ
sashreliefbgrZnews)rowZ
columnspanstickyz --- z#ddf)rr)Zheighttextr4fontr/r.z START Zwhitez#fed)r8r9fgZdisabledforegroundcommandz STOP z CLEAR )rr
)r5columnr6padxZew)r5r<r6FzChoose example from menublack)4ZTkrootturtle_roottitleZwm_protocol_destroyr
subprocessrunformatr%getpidZDEVNULLZgrid_rowconfigureZgrid_columnconfigureMenuZRAISEDZmBarZadd_cascademakeLoadDemoMenumakeFontMenumakeHelpMenuZPanedWindow
HORIZONTALZSOLIDadd
makeTextFramemakeGraphFrameZgridZLabelZRIDGE
output_lblZButtonbtnfont	startDemo	start_btnstopItstop_btnclearCanvas	clear_btnrr8Zinsertfilterrdirtyexitflagloadfile	configGUIDISABLEDSTARTUPstate)selffilenamer?rDZpaner"r"r#__init__s




zDemoWindow.__init__cCsP|j}|j}|jd|j||j|jd|j||jdS)Ng?)_canvasZwinfo_widthZwinfo_heightZxview_moveto	canvwidthZyview_moveto
canvheight)r_eventZcwidthZcheightr"r"r#onResizes

zDemoWindow.onResizecCs6t||_}t|ddddd|_}t|t|dd|_}|j|d<|jt	t
d	t|d
td|_}|j
|d<|jttd	|j|d<|j|d
<tt|d<trdnd}|d||j|d||j|d||j|d||j|d|j|d|j|d|j|jt	tdd|S)Nr8r
Znone-)namer=Zwrapwidthvbar)rhr;)sidefillhbar)rhr3ZyscrollcommandZxscrollcommandr9ZCommandZControlz
<%s-minus>z<%s-underscore>z
<%s-equal>z	<%s-plus>z<Control-MouseWheel>z<Control-Button-4>z<Control-Button-5>r	)rkrlexpand)ZFrame
text_frameZTextr8rZ	ScrollbarrjZyviewZpackZLEFTYrLrmZxviewZBOTTOMXsettupletxtfontrZbind_all
decrease_size
increase_sizebindupdate_mousewheelZBOTH)r_r?ror8rjrmZshortcutr"r"r#rNs2



zDemoWindow.makeTextFramecCs|tj_d|_d|_t|dd|j|jtj_|_}||j	d|j
d|jd<t|_}tj
||j|j|_|gtj_|S)Nii iXz<Configure>rr/)r@Z_ScreenrArcrdZScrolledCanvasrbZ
adjustScrollsZ_rootwindowrwrfZScreenscreenTurtleScreenrascanvasZ	RawTurtleZscreens)r_r?ZcanvasZ_s_r"r"r#rOs$

zDemoWindow.makeGraphFramecCs(|td<tt|jd<d||jd<dS)Nr	r9zFont size %dr8)rtrsr8rP)r_sizer"r"r#set_txtsizeszDemoWindow.set_txtsizecCs|ttddtdSNr	break)r}maxrtMINIMUM_FONT_SIZEr_Zdummyr"r"r#ruszDemoWindow.decrease_sizecCs|ttddtdSr~)r}minrtMAXIMUM_FONT_SIZErr"r"r#rvszDemoWindow.increase_sizecCs$|jdktkr|S|SdS)Nr)Zdeltarrurv)r_rer"r"r#rxszDemoWindow.update_mousewheelbluecCsh|jj||tkrdndd|jj||tkr0dndd|jj||tkrLdndd|jj||ddS)Nz#d00z#fca)r^r4)r8r:)rSconfigNORMALrUrWrP)r_startstopclearZtxtZcolorr"r"r#r[szDemoWindow.configGUIcs:t|}tD]&}|ffdd	}|j|dt|dq|S)Ncs|dSN)rZ)r!r_r"r#loadsz)DemoWindow.makeLoadDemoMenu.<locals>.loadrr1r2r9r;)rHr(add_commandmenufont)r_masterr0r!rr"rr#rIs
zDemoWindow.makeLoadDemoMenucsht|}|jdjtd|jdjtd|tD]*}|ffdd	}|jt|dt|dq8|S)NzDecrease (C-'-'))r1r;r9zIncrease (C-'+')cs|dSr)r})r|rr"r#resize(sz'DemoWindow.makeFontMenu.<locals>.resizerr)rHrrurrvZ
add_separator
font_sizesstr)r_rr0r|rr"rr#rJs

zDemoWindow.makeFontMenucs<t|}tD]*\}}||ffdd	}|j|t|dq|S)Ncstj||dSr)rr?)
help_label	help_filerr"r#show2sz%DemoWindow.makeHelpMenu.<locals>.show)r1r9r;)rHhelp_entriesrr)r_rr0rrrr"rr#rK.s
zDemoWindow.makeHelpMenucCs|jr|jd|_dSNF)rXryrrr"r"r#
refreshCanvas7s
zDemoWindow.refreshCanvasc	Cs|dtj_d|}t|tj||_t|jj	d}|
}W5QRX|jdd|j
d||j|d|tttddt|_dS)	NFzturtledemo.rz1.0endz# - a Python turtle graphics examplezPress start buttonred)rVr@rz_RUNNING
__import__sysmodulesmoduleopen__file__readr8deleteinsertr?rBr[rr\READYr^)r_r`modnamefcharsr"r"r#rZ<s
zDemoWindow.loadfilecCs|d|_dtj_|tttdd|j	|j
dt|_z$|j
}|dkr`t|_nt|_Wn0tjk
r|jdkrYdSt|_d}YnX|jtkr|ttt|n"|jtkrd|_|tttdddS)	NTzdemo running...r>ZstandardZ	EVENTLOOPzstopped!zuse mouse/keys or STOPr)rrXr@rzrr[r\rryrmodeRUNNINGr^rmainEVENTDRIVENDONEZ
Terminatorr?rY)r_resultr"r"r#rRKs<









zDemoWindow.startDemocCs4||jd|jjdd|tttdS)Nallr)Zcursor)rryZ_deleter{rr[rr\rr"r"r#rVhszDemoWindow.clearCanvascCs2|jr&|d|_|tttdddtj_dS)NFzSTOPPED!r)rYrVr[rr\r@rzrrr"r"r#rTns
zDemoWindow.stopItcCsdtj_|jd|_dSr)r@rzrr?Zdestroyrr"r"r#rCvs
zDemoWindow._destroy)N)N)N)rr)__name__
__module____qualname__rarfrNrOr}rurvrxr[rIrJrKrrZrRrVrTrCr"r"r"r#r)s$
D


	
	r)cCst}|jdSr)r)r?Zmainloop)Zdemor"r"r#r|sr__main__)'rrr%ZtkinterZidlelib.colorizerrrZidlelib.percolatorrZidlelib.textviewrZ
turtledemoZabout_turtledemor@pathdirnameabspathrr'platformrr]rrrrrrrQrtrrrr(robjectr)rrr"r"r"r#<module>s>U


~