%PDF- %PDF-
Direktori : /lib/python3.12/__pycache__/ |
Current File : //lib/python3.12/__pycache__/turtle.cpython-312.pyc |
� ���f�; � �^ � d Z ddlZddlZddlZddlZddlZddlZddlZddl m Z mZmZ ddl mZ ddlmZ g d�Zg d�Zg d�Zd d gZeez ez ez dgz Zg d�Zi d d�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd �d!d"�d#d"�d$d%�d&d'�d(d)�d*d+�d,d-d.d/��Zd0� Zd1� Z ee� G d3� d4e� Zd5� Zd6� Zd7Zdgd8�Z G d9� d:ejB � Z" e e"ejF d;� G d<� d=ejH � Z%ejF Z# G d>� d?e&� Z' G d@� de� Z( G dA� dBe� Z) G dC� dDe&� Z* G dE� dFe&� Z+ G dG� dHe'� Z, G dI� dJe&� Z- G dK� dLe&� Z. G dM� dNe&� Z/ G dO� dPe.e-� Z0e0Z1dQ� Z2 G dR� dSe,� Z3 G dT� dUe0� Z4e4Z5dhdV�Z6dW� Z7ed( Z8 e8d)k7 r e7e8� dZ� Z:d[� Z;d\� Z<d]Z=d^� Z> e>ee3d_d`e<� e>ee4dadbe;� e?Z@eAdck( rdd� ZBde� ZCdf� ZD eC� eD� eE� yy# e$ r ed2� Y ��dw xY w# e9$ r edXe8� Y �qe$ r edYe8z � Y ��w xY w)ia� Turtle graphics is a popular way for introducing programming to kids. It was part of the original Logo programming language developed by Wally Feurzig and Seymour Papert in 1966. Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an ``import turtle``, give it the command turtle.forward(15), and it moves (on-screen!) 15 pixels in the direction it is facing, drawing a line as it moves. Give it the command turtle.right(25), and it rotates in-place 25 degrees clockwise. By combining together these and similar commands, intricate shapes and pictures can easily be drawn. ----- turtle.py This module is an extended reimplementation of turtle.py from the Python standard distribution up to Python 2.5. (See: https://www.python.org) It tries to keep the merits of turtle.py and to be (nearly) 100% compatible with it. This means in the first place to enable the learning programmer to use all the commands, classes and methods interactively when using the module from within IDLE run with the -n switch. Roughly it has the following features added: - Better animation of the turtle movements, especially of turning the turtle. So the turtles can more easily be used as a visual feedback instrument by the (beginning) programmer. - Different turtle shapes, gif-images as turtle shapes, user defined and user controllable turtle shapes, among them compound (multicolored) shapes. Turtle shapes can be stretched and tilted, which makes turtles very versatile geometrical objects. - Fine control over turtle movement and screen updates via delay(), and enhanced tracer() and speed() methods. - Aliases for the most commonly used commands, like fd for forward etc., following the early Logo traditions. This reduces the boring work of typing long sequences of commands, which often occur in a natural way when kids try to program fancy pictures on their first encounter with turtle graphics. - Turtles now have an undo()-method with configurable undo-buffer. - Some simple commands/methods for creating event driven programs (mouse-, key-, timer-events). Especially useful for programming games. - A scrollable Canvas class. The default scrollable Canvas can be extended interactively as needed while playing around with the turtle(s). - A TurtleScreen class with methods controlling background color or background image, window and canvas size and other properties of the TurtleScreen. - There is a method, setworldcoordinates(), to install a user defined coordinate-system for the TurtleScreen. - The implementation uses a 2-vector class named Vec2D, derived from tuple. This class is public, so it can be imported by the application programmer, which makes certain types of computations very natural and compact. - Appearance of the TurtleScreen and the Turtles at startup/import can be configured by means of a turtle.cfg configuration file. The default configuration mimics the appearance of the old turtle module. - If configured appropriately the module reads in docstrings from a docstring dictionary in some different language, supplied separately and replaces the English ones by those read in. There is a utility function write_docstringdict() to write a dictionary with the original (English) docstrings to disc, so it can serve as a template for translations. Behind the scenes there are some features included with possible extensions in mind. These will be commented and documented elsewhere. � N)�isfile�split�join)�deepcopy)�simpledialog) �ScrolledCanvas�TurtleScreen�Screen� RawTurtle�Turtle�RawPen�Pen�Shape�Vec2D)�addshape�bgcolor�bgpic�bye�clearscreen� colormode�delay�exitonclick� getcanvas� getshapes�listen�mainloop�mode�numinput�onkey� onkeypress�onkeyrelease� onscreenclick�ontimer�register_shape�resetscreen� screensize�setup�setworldcoordinates� textinput�title�tracer�turtles�update� window_height�window_width)P�back�backward� begin_fill� begin_poly�bk�circle�clear� clearstamp�clearstamps�clone�color�degrees�distance�dot�down�end_fill�end_poly�fd� fillcolor�filling�forward�get_poly�getpen� getscreen� get_shapepoly� getturtle�goto�heading� hideturtle�home�ht�isdown� isvisible�left�lt�onclick�ondrag� onrelease�pd�pen�pencolor�pendown�pensize�penup�pos�position�pu�radians�right�reset� resizemode�rt�seth� setheading�setpos�setposition�settiltangle� setundobuffer�setx�sety�shape� shapesize�shapetransform�shearfactor� showturtle�speed�st�stamp�teleport�tilt� tiltangle�towards� turtlesize�undo�undobufferentries�up�width�write�xcor�ycor�write_docstringdict�done� Terminator)r r1 r4 rA rN rR rV r\ r^ rc rd rf rg rr rx r{ r| r| � �?�heightg �?� canvwidthi� � canvheighti, � leftright� topbottomr �standardr � �?r � �undobuffersizei� rl �classicrX �blackrB rb �noresize�visibleT�language�english� exampleturtle�turtle�screenzPython Turtle GraphicsF)� examplescreenr* � using_IDLEc �� � t | d� 5 }|j � }ddd� i }D ]� }|j � }|r|j d� r�' |j d� \ }}|j � }|j � }|dv rt |� }n d|v rt |� }nt |� }|||<