HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //lib64/python3.9/turtledemo/__pycache__/__main__.cpython-39.opt-2.pyc
a

R�f�:�@s�ddlZddlZddlTddlmZmZddlmZddlm	Z	ddl
mZddl
Z
ej�ej�e��ZejdkZdZd	Zd
ZdZdZd
defZdZgd�ZdZdZgd�Z dd�Z!defdefde
jffZ"Gdd�de#�Z$dd�Z%e&dkr�e%�dS)�N)�*)�ColorDelegator�color_config)�
Percolator)�	view_text)�__doc__�darwin������Arial�)rrZbold)zLucida Console�
�normal��d)��	r�r������cCsdd�t�t�D�S)NcSs.g|]&}|�d�r|ddkr|dd��qS)z.pyr�_N���)�endswith)�.0�entry�r"�+/usr/lib64/python3.9/turtledemo/__main__.py�
<listcomp>us�z%getExampleEntries.<locals>.<listcomp>)�os�listdir�demo_dirr"r"r"r#�getExampleEntriestsr(zTurtledemo helpzAbout turtledemozAbout turtle modulec@s�eZdZd(dd�Zdd�Zdd�Zdd	�Zd
d�Zd)dd
�Zd*dd�Z	dd�Z
d+dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�ZdS),�
DemoWindowNc	Cs�t�|_}t_|�d�|�d|j�trbddl}|j	ddddd�
t���ddg|j
|j
d	�|jdd
d�|jdd
d�|jd
dd
d
�|jddd
d
�|jddd
d
�t|tdd�|_|jj|�|j�ddd�|jj|�|j�ddd�|jj|�|j�ddd�|j|d<ttdtdd�}|�|�|��|�|�|��|jdddd�t|d
ddddtd�|_ t�r�t!|d t"d!|j#d"�|_$t!|d#t"d!|j%d"�|_&t!|d$t"d!|j'd"�|_(nHt!|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,|_.|�rx|�/|�|�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)�stderr�stdoutr	)�weight�Z)Zminsizer,r
r)�relief�borderwidthZExamples)�menu�label�	underlineZFontsizeZHelpr0r
z#ddd)�orientZ	sashwidthZ
sashrelief�bgr�news)�rowZ
columnspan�stickyz --- z#ddf)r�r)Zheight�textr4�fontr/r.z START z#00cc22)r9r:�fg�commandz STOP z CLEAR Zwhitez#fed)r9r:r;Zdisabledforegroundr<)rr
)r6�columnr7�padxZew)r6r=r7FzChoose example from menu�black)4ZTk�root�turtle�_root�titleZwm_protocol�_destroyr�
subprocess�run�formatr%�getpid�DEVNULLZgrid_rowconfigureZgrid_columnconfigure�MenuZRAISEDZmBarZadd_cascade�makeLoadDemoMenu�makeFontMenu�makeHelpMenuZPanedWindow�
HORIZONTALZSOLID�add�
makeTextFrame�makeGraphFrameZgridZLabelZRIDGE�
output_lblZButton�btnfont�	startDemo�	start_btn�stopIt�stop_btn�clearCanvas�	clear_btnrr9Zinsertfilterr�dirty�exitflag�loadfile�	configGUI�DISABLED�STARTUP�state)�self�filenamer@rEZpaner"r"r#�__init__�s�
������
�
����
���

�zDemoWindow.__init__cCsP|j��}|j��}|j�d|j||j�|j�d|j||j�dS)Ng�?)�_canvasZwinfo_widthZwinfo_heightZxview_moveto�	canvwidthZyview_moveto�
canvheight)ra�eventZcwidthZcheightr"r"r#�onResize�s

zDemoWindow.onResizecCs6t|�|_}t|ddddd�|_}t|�t|dd�|_}|j|d<|jt	t
d	�t|d
td�|_}|j
|d<|jttd	�|j|d<|j|d
<tt�|d<tr�dnd}|�d||j�|�d||j�|�d||j�|�d||j�|�d|j�|�d|j�|�d|j�|jt	tdd�|S)Nr9r
Znone�-)�namer>�wrap�width�vbar)rjr<)�side�fill�hbar)rjr3ZyscrollcommandZxscrollcommandr:ZCommandZControlz
<%s-minus>z<%s-underscore>z
<%s-equal>z	<%s-plus>z<Control-MouseWheel>z<Control-Button-4>z<Control-Button-5>r	)rnro�expand)ZFrame�
text_frame�Textr9rZ	ScrollbarrmZyview�packZLEFT�YrNrpZxviewZBOTTOM�X�set�tuple�txtfontrZbind_all�
decrease_size�
increase_size�bind�update_mousewheelZBOTH)rar@rrr9rmrpZshortcutr"r"r#rP�s0�



zDemoWindow.makeTextFramecCs�|tj_d|_d|_t�|dd|j|j�tj_|_}|��|j�	d|j
�d|jd<t��|_}tj
�||j�|j|_|gtj_|S)Ni�i iXz<Configure>rr/)rAZ_ScreenrBrerfZScrolledCanvasrdZ
adjustScrollsZ_rootwindowr|rhZScreen�screen�TurtleScreenrc�scanvasZ	RawTurtleZscreens)rar@ZcanvasZ_s_r"r"r#rQ�s�

zDemoWindow.makeGraphFramecCs(|td<tt�|jd<d||jd<dS)Nr	r:zFont size %dr9)ryrxr9rR)ra�sizer"r"r#�set_txtsize�szDemoWindow.set_txtsizecCs|�ttddt��dS�Nr	�break)r��maxry�MINIMUM_FONT_SIZE�ra�dummyr"r"r#rzszDemoWindow.decrease_sizecCs|�ttddt��dSr�)r��minry�MAXIMUM_FONT_SIZEr�r"r"r#r{szDemoWindow.increase_sizecCs$|jdktkr|��S|��SdS)Nr)Zdeltarrzr{)rargr"r"r#r}szDemoWindow.update_mousewheel��bluecCs�tr0|jj|d�|jj|d�|jj|d�nT|jj||tkrDdndd�|jj||tkr`dndd�|jj||tkr|dndd�|jj||d�dS)N)r`z#d00z#fca)r`r4)r9r;)rrU�configrWrY�NORMALrR)ra�start�stop�clearZtxtZcolorr"r"r#r]s���zDemoWindow.configGUIcs:t|�}t�D]&}|f�fdd�	}|j|dt|d�q|S)Ncs��|�dS�N)r\)r!�rar"r#�load&sz)DemoWindow.makeLoadDemoMenu.<locals>.loadr�r1r2r:r<)rJr(�add_command�menufont)ra�masterr0r!r�r"r�r#rK"s
�zDemoWindow.makeLoadDemoMenucsht|�}|jd�jtd�|jd�jtd�|��tD]*}|f�fdd�	}|jt|�dt|d�q8|S)NzDecrease (C-'-'))r1r<r:zIncrease (C-'+')cs��|�dSr�)r�)r�r�r"r#�resize5sz'DemoWindow.makeFontMenu.<locals>.resizerr�)rJr�rzr�r{Z
add_separator�
font_sizes�str)rar�r0r�r�r"r�r#rL,s
�
��zDemoWindow.makeFontMenucs<t|�}tD]*\}}||f�fdd�	}|j|t|d�q|S)Ncst�j||�dSr�)rr@)�
help_label�	help_filer�r"r#�show?sz%DemoWindow.makeHelpMenu.<locals>.show)r1r:r<)rJ�help_entriesr�r�)rar�r0r�r�r�r"r�r#rM;s
zDemoWindow.makeHelpMenucCs|jr|j��d|_dS�NF)rZr~r�r�r"r"r#�
refreshCanvasDs
zDemoWindow.refreshCanvascCs�|��dtj_d|}t|�tj||_t|jj	d��}|�
�}Wd�n1sX0Y|j�dd�|j�
d|�|j�|d�|�tttdd�t|_dS)	NFzturtledemo.�rz1.0�endz# - a Python turtle graphics examplezPress start button�red)rXrAr�_RUNNING�
__import__�sys�modules�module�open�__file__�readr9�delete�insertr@rCr]r�r^�READYr`)rarb�modname�f�charsr"r"r#r\Is&
�zDemoWindow.loadfilecCs�|��d|_dtj_|�tttdd�|j�	�|j�
d�t|_z$|j
��}|dkr`t|_nt|_Wn.tjy�|jdur�YdSt|_d}Yn0|jtkr�|�ttt|�n"|jtkr�d|_|�tttdd�dS)	NTzdemo running...r?ZstandardZ	EVENTLOOPzstopped!zuse mouse/keys or STOPr�)r�rZrArr�r]r^r�r~r��mode�RUNNINGr`r��main�EVENTDRIVEN�DONEZ
Terminatorr@r[)ra�resultr"r"r#rTXs8
�






�

�zDemoWindow.startDemocCs4|��|j�d�|jjdd�|�ttt�dS)N�allr�)Zcursor)r�r~�_deleter�r�r]r�r^r�r"r"r#rXuszDemoWindow.clearCanvascCs2|jr&|��d|_|�tttdd�dtj_dS)NFzSTOPPED!r�)r[rXr]r�r^rArr�r�r"r"r#rV{s
�zDemoWindow.stopItcCsdtj_|j��d|_dSr�)rArr�r@Zdestroyr�r"r"r#rD�s
zDemoWindow._destroy)N)N)N)r�r�)�__name__�
__module__�__qualname__rcrhrPrQr�rzr{r}r]rKrLrMr�r\rTrXrVrDr"r"r"r#r)s$
L



	r)cCst�}|j��dSr�)r)r@Zmainloop)�demor"r"r#r��sr��__main__)'r�r%�tkinterZidlelib.colorizerrrZidlelib.percolatorrZidlelib.textviewrZ
turtledemorZabout_turtledemorA�path�dirname�abspathr�r'�platformrr_r�r�r�r�r�r�rSryr�r�r�r(r��objectr)r�r�r"r"r"r#�<module>Xs>

�