| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 020e09a commit 96d1eb1
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,5 @@ | |||
| 1 | - .. _ast: | ||
| 2 | - | ||
| 3 | - Abstract Syntax Trees | ||
| 4 | - ===================== | ||
| 1 | + :mod:`ast` --- Abstract Syntax Trees | ||
| 2 | + ==================================== | ||
| 5 | 3 | ||
| 6 | 4 | .. module:: ast | |
| 7 | 5 | :synopsis: Abstract Syntax Tree classes and manipulation. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,5 +13,6 @@ The full list of modules described in this chapter is: | |||
| 13 | 13 | ||
| 14 | 14 | .. toctree:: | |
| 15 | 15 | ||
| 16 | + turtle.rst | ||
| 16 | 17 | cmd.rst | |
| 17 | 18 | shlex.rst | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,3 @@ | |||
| 1 | - .. _debugger: | ||
| 2 | - | ||
| 3 | 1 | :mod:`pdb` --- The Python Debugger | |
| 4 | 2 | ================================== | |
| 5 | 3 | ||
@@ -158,7 +156,7 @@ access further features, you have to do this yourself: | |||
| 158 | 156 | .. _debugger-commands: | |
| 159 | 157 | ||
| 160 | 158 | Debugger Commands | |
| 161 | - ================= | ||
| 159 | + ----------------- | ||
| 162 | 160 | ||
| 163 | 161 | The debugger recognizes the following commands. Most commands can be | |
| 164 | 162 | abbreviated to one or two letters; e.g. ``h(elp)`` means that either ``h`` or | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -490,7 +490,7 @@ always available. | |||
| 490 | 490 | Their intended use is to allow an interactive user to import a debugger module | |
| 491 | 491 | and engage in post-mortem debugging without having to re-execute the command | |
| 492 | 492 | that caused the error. (Typical use is ``import pdb; pdb.pm()`` to enter the | |
| 493 | - post-mortem debugger; see chapter :ref:`debugger` for | ||
| 493 | + post-mortem debugger; see :mod:`pdb` module for | ||
| 494 | 494 | more information.) | |
| 495 | 495 | ||
| 496 | 496 | The meaning of the variables is the same as that of the return values from | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,6 @@ alternatives, see the :ref:`other-gui-packages` section. | |||
| 36 | 36 | tkinter.ttk.rst | |
| 37 | 37 | tkinter.tix.rst | |
| 38 | 38 | tkinter.scrolledtext.rst | |
| 39 | - turtle.rst | ||
| 40 | 39 | idle.rst | |
| 41 | 40 | othergui.rst | |
| 42 | 41 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,9 @@ | |||
| 1 | - ======================================== | ||
| 2 | - :mod:`turtle` --- Turtle graphics for Tk | ||
| 3 | - ======================================== | ||
| 1 | + ================================= | ||
| 2 | + :mod:`turtle` --- Turtle graphics | ||
| 3 | + ================================= | ||
| 4 | 4 | ||
| 5 | 5 | .. module:: turtle | |
| 6 | - :synopsis: Turtle graphics for Tk | ||
| 6 | + :synopsis: An educational framework for simple graphics applications | ||
| 7 | 7 | .. sectionauthor:: Gregor Lingl <gregor.lingl@aon.at> | |
| 8 | 8 | ||
| 9 | 9 | .. testsetup:: default | |
@@ -58,7 +58,7 @@ The object-oriented interface uses essentially two+two classes: | |||
| 58 | 58 | or TurtleScreen as argument, so the RawTurtle objects know where to draw. | |
| 59 | 59 | ||
| 60 | 60 | Derived from RawTurtle is the subclass :class:`Turtle` (alias: :class:`Pen`), | |
| 61 | - which draws on "the" :class:`Screen` - instance which is automatically | ||
| 61 | + which draws on "the" :class:`Screen` instance which is automatically | ||
| 62 | 62 | created, if not already present. | |
| 63 | 63 | ||
| 64 | 64 | All methods of RawTurtle/Turtle also exist as functions, i.e. part of the | |
@@ -71,15 +71,15 @@ function derived from a Screen method is called. An (unnamed) turtle object is | |||
| 71 | 71 | automatically created whenever any of the functions derived from a Turtle method | |
| 72 | 72 | is called. | |
| 73 | 73 | ||
| 74 | - To use multiple turtles an a screen one has to use the object-oriented interface. | ||
| 74 | + To use multiple turtles on a screen one has to use the object-oriented interface. | ||
| 75 | 75 | ||
| 76 | 76 | .. note:: | |
| 77 | 77 | In the following documentation the argument list for functions is given. | |
| 78 | 78 | Methods, of course, have the additional first argument *self* which is | |
| 79 | 79 | omitted here. | |
| 80 | 80 | ||
| 81 | 81 | ||
| 82 | - Overview over available Turtle and Screen methods | ||
| 82 | + Overview of available Turtle and Screen methods | ||
| 83 | 83 | ================================================= | |
| 84 | 84 | ||
| 85 | 85 | Turtle methods | |
@@ -645,8 +645,8 @@ Tell Turtle's state | |||
| 645 | 645 | >>> turtle.forward(100) | |
| 646 | 646 | >>> turtle.pos() | |
| 647 | 647 | (64.28,76.60) | |
| 648 | - >>> print(turtle.xcor()) | ||
| 649 | - 64.2787609687 | ||
| 648 | + >>> print(round(turtle.xcor(), 5)) | ||
| 649 | + 64.27876 | ||
| 650 | 650 | ||
| 651 | 651 | ||
| 652 | 652 | .. function:: ycor() | |
@@ -660,8 +660,8 @@ Tell Turtle's state | |||
| 660 | 660 | >>> turtle.forward(100) | |
| 661 | 661 | >>> print(turtle.pos()) | |
| 662 | 662 | (50.00,86.60) | |
| 663 | - >>> print(turtle.ycor()) | ||
| 664 | - 86.6025403784 | ||
| 663 | + >>> print(round(turtle.ycor(), 5)) | ||
| 664 | + 86.60254 | ||
| 665 | 665 | ||
| 666 | 666 | ||
| 667 | 667 | .. function:: heading() | |
@@ -714,7 +714,10 @@ Settings for measurement | |||
| 714 | 714 | >>> turtle.left(90) | |
| 715 | 715 | >>> turtle.heading() | |
| 716 | 716 | 90.0 | |
| 717 | - >>> turtle.degrees(400.0) # angle measurement in gon | ||
| 717 | + | ||
| 718 | + Change angle measurement unit to grad (also known as gon, | ||
| 719 | + grade, or gradian and equals 1/100-th of the right angle.) | ||
| 720 | + >>> turtle.degrees(400.0) | ||
| 718 | 721 | >>> turtle.heading() | |
| 719 | 722 | 100.0 | |
| 720 | 723 | >>> turtle.degrees(360) | |
@@ -810,20 +813,16 @@ Drawing state | |||
| 810 | 813 | >>> sorted(turtle.pen().items()) | |
| 811 | 814 | [('fillcolor', 'black'), ('outline', 1), ('pencolor', 'red'), | |
| 812 | 815 | ('pendown', True), ('pensize', 10), ('resizemode', 'noresize'), | |
| 813 | - ('shown', True), ('speed', 9), ('stretchfactor', (1, 1)), ('tilt', 0)] | ||
| 816 | + ('shearfactor', 0.0), ('shown', True), ('speed', 9), | ||
| 817 | + ('stretchfactor', (1.0, 1.0)), ('tilt', 0.0)] | ||
| 814 | 818 | >>> penstate=turtle.pen() | |
| 815 | 819 | >>> turtle.color("yellow", "") | |
| 816 | 820 | >>> turtle.penup() | |
| 817 | - >>> sorted(turtle.pen().items()) | ||
| 818 | - [('fillcolor', ''), ('outline', 1), ('pencolor', 'yellow'), | ||
| 819 | - ('pendown', False), ('pensize', 10), ('resizemode', 'noresize'), | ||
| 820 | - ('shown', True), ('speed', 9), ('stretchfactor', (1, 1)), ('tilt', 0)] | ||
| 821 | + >>> sorted(turtle.pen().items())[:3] | ||
| 822 | + [('fillcolor', ''), ('outline', 1), ('pencolor', 'yellow')] | ||
| 821 | 823 | >>> turtle.pen(penstate, fillcolor="green") | |
| 822 | - >>> sorted(turtle.pen().items()) | ||
| 823 | - [('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red'), | ||
| 824 | - ('pendown', True), ('pensize', 10), ('resizemode', 'noresize'), | ||
| 825 | - ('shown', True), ('speed', 9), ('stretchfactor', (1, 1)), ('tilt', 0)] | ||
| 826 | - | ||
| 824 | + >>> sorted(turtle.pen().items())[:3] | ||
| 825 | + [('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red')] | ||
| 827 | 826 | ||
| 828 | 827 | .. function:: isdown() | |
| 829 | 828 | ||
@@ -884,10 +883,10 @@ Color control | |||
| 884 | 883 | (0.2, 0.8, 0.5490196078431373) | |
| 885 | 884 | >>> colormode(255) | |
| 886 | 885 | >>> turtle.pencolor() | |
| 887 | - (51, 204, 140) | ||
| 886 | + (51.0, 204.0, 140.0) | ||
| 888 | 887 | >>> turtle.pencolor('#32c18f') | |
| 889 | 888 | >>> turtle.pencolor() | |
| 890 | - (50, 193, 143) | ||
| 889 | + (50.0, 193.0, 143.0) | ||
| 891 | 890 | ||
| 892 | 891 | ||
| 893 | 892 | .. function:: fillcolor(*args) | |
@@ -924,13 +923,13 @@ Color control | |||
| 924 | 923 | 'violet' | |
| 925 | 924 | >>> col = turtle.pencolor() | |
| 926 | 925 | >>> col | |
| 927 | - (50, 193, 143) | ||
| 926 | + (50.0, 193.0, 143.0) | ||
| 928 | 927 | >>> turtle.fillcolor(col) | |
| 929 | 928 | >>> turtle.fillcolor() | |
| 930 | - (50, 193, 143) | ||
| 929 | + (50.0, 193.0, 143.0) | ||
| 931 | 930 | >>> turtle.fillcolor('#ffffff') | |
| 932 | 931 | >>> turtle.fillcolor() | |
| 933 | - (255, 255, 255) | ||
| 932 | + (255.0, 255.0, 255.0) | ||
| 934 | 933 | ||
| 935 | 934 | ||
| 936 | 935 | .. function:: color(*args) | |
@@ -963,7 +962,7 @@ Color control | |||
| 963 | 962 | ('red', 'green') | |
| 964 | 963 | >>> color("#285078", "#a0c8f0") | |
| 965 | 964 | >>> color() | |
| 966 | - ((40, 80, 120), (160, 200, 240)) | ||
| 965 | + ((40.0, 80.0, 120.0), (160.0, 200.0, 240.0)) | ||
| 967 | 966 | ||
| 968 | 967 | ||
| 969 | 968 | See also: Screen method :func:`colormode`. | |
@@ -1157,7 +1156,7 @@ Appearance | |||
| 1157 | 1156 | .. doctest:: | |
| 1158 | 1157 | ||
| 1159 | 1158 | >>> turtle.shapesize() | |
| 1160 | - (1, 1, 1) | ||
| 1159 | + (1.0, 1.0, 1) | ||
| 1161 | 1160 | >>> turtle.resizemode("user") | |
| 1162 | 1161 | >>> turtle.shapesize(5, 5, 12) | |
| 1163 | 1162 | >>> turtle.shapesize() | |
@@ -1184,7 +1183,7 @@ Appearance | |||
| 1184 | 1183 | >>> turtle.shapesize(5,2) | |
| 1185 | 1184 | >>> turtle.shearfactor(0.5) | |
| 1186 | 1185 | >>> turtle.shearfactor() | |
| 1187 | - >>> 0.5 | ||
| 1186 | + 0.5 | ||
| 1188 | 1187 | ||
| 1189 | 1188 | ||
| 1190 | 1189 | .. function:: tilt(angle) | |
@@ -1268,11 +1267,12 @@ Appearance | |||
| 1268 | 1267 | ||
| 1269 | 1268 | .. doctest:: | |
| 1270 | 1269 | ||
| 1270 | + >>> turtle = Turtle() | ||
| 1271 | 1271 | >>> turtle.shape("square") | |
| 1272 | 1272 | >>> turtle.shapesize(4,2) | |
| 1273 | 1273 | >>> turtle.shearfactor(-0.5) | |
| 1274 | 1274 | >>> turtle.shapetransform() | |
| 1275 | - >>> (4.0, -1.0, -0.0, 2.0) | ||
| 1275 | + (4.0, -1.0, -0.0, 2.0) | ||
| 1276 | 1276 | ||
| 1277 | 1277 | ||
| 1278 | 1278 | .. function:: get_shapepoly() | |
@@ -1456,8 +1456,8 @@ Special Turtle methods | |||
| 1456 | 1456 | ||
| 1457 | 1457 | .. _compoundshapes: | |
| 1458 | 1458 | ||
| 1459 | - Excursus about the use of compound shapes | ||
| 1460 | - ----------------------------------------- | ||
| 1459 | + Compound shapes | ||
| 1460 | + --------------- | ||
| 1461 | 1461 | ||
| 1462 | 1462 | To use compound turtle shapes, which consist of several polygons of different | |
| 1463 | 1463 | color, you must use the helper class :class:`Shape` explicitly as described | |
@@ -1511,6 +1511,7 @@ Window control | |||
| 1511 | 1511 | :param args: a color string or three numbers in the range 0..colormode or a | |
| 1512 | 1512 | 3-tuple of such numbers | |
| 1513 | 1513 | ||
| 1514 | + | ||
| 1514 | 1515 | Set or return background color of the TurtleScreen. | |
| 1515 | 1516 | ||
| 1516 | 1517 | .. doctest:: | |
@@ -1520,7 +1521,7 @@ Window control | |||
| 1520 | 1521 | 'orange' | |
| 1521 | 1522 | >>> screen.bgcolor("#800080") | |
| 1522 | 1523 | >>> screen.bgcolor() | |
| 1523 | - (128, 0, 128) | ||
| 1524 | + (128.0, 0.0, 128.0) | ||
| 1524 | 1525 | ||
| 1525 | 1526 | ||
| 1526 | 1527 | .. function:: bgpic(picname=None) | |
@@ -1548,7 +1549,7 @@ Window control | |||
| 1548 | 1549 | ||
| 1549 | 1550 | .. note:: | |
| 1550 | 1551 | This TurtleScreen method is available as a global function only under the | |
| 1551 | - name ``clearscreen``. The global function ``clear`` is another one | ||
| 1552 | + name ``clearscreen``. The global function ``clear`` is a different one | ||
| 1552 | 1553 | derived from the Turtle method ``clear``. | |
| 1553 | 1554 | ||
| 1554 | 1555 | ||
@@ -1643,10 +1644,12 @@ Animation control | |||
| 1643 | 1644 | :param n: nonnegative integer | |
| 1644 | 1645 | :param delay: nonnegative integer | |
| 1645 | 1646 | ||
| 1646 | - Turn turtle animation on/off and set delay for update drawings. If *n* is | ||
| 1647 | - given, only each n-th regular screen update is really performed. (Can be | ||
| 1648 | - used to accelerate the drawing of complex graphics.) Second argument sets | ||
| 1649 | - delay value (see :func:`delay`). | ||
| 1647 | + Turn turtle animation on/off and set delay for update drawings. If | ||
| 1648 | + *n* is given, only each n-th regular screen update is really | ||
| 1649 | + performed. (Can be used to accelerate the drawing of complex | ||
| 1650 | + graphics.) When called without arguments, returns the currently | ||
| 1651 | + stored value of n. Second argument sets delay value (see | ||
| 1652 | + :func:`delay`). | ||
| 1650 | 1653 | ||
| 1651 | 1654 | .. doctest:: | |
| 1652 | 1655 | ||
@@ -1790,8 +1793,8 @@ Input methods | |||
| 1790 | 1793 | :param title: string | |
| 1791 | 1794 | :param prompt: string | |
| 1792 | 1795 | :param default: number (optional) | |
| 1793 | - :param prompt: number (optional) | ||
| 1794 | - :param prompt: number (optional) | ||
| 1796 | + :param minval: number (optional) | ||
| 1797 | + :param maxval: number (optional) | ||
| 1795 | 1798 | ||
| 1796 | 1799 | Pop up a dialog window for input of a number. title is the title of the | |
| 1797 | 1800 | dialog window, prompt is a text mostly describing what numerical information | |
@@ -1991,8 +1994,8 @@ Methods specific to Screen, not inherited from TurtleScreen | |||
| 1991 | 1994 | >>> screen.title("Welcome to the turtle zoo!") | |
| 1992 | 1995 | ||
| 1993 | 1996 | ||
| 1994 | - The public classes of the module :mod:`turtle` | ||
| 1995 | - ============================================== | ||
| 1997 | + Public classes | ||
| 1998 | + ============== | ||
| 1996 | 1999 | ||
| 1997 | 2000 | ||
| 1998 | 2001 | .. class:: RawTurtle(canvas) | |
@@ -2323,7 +2326,7 @@ The demoscripts are: | |||
| 2323 | 2326 | +----------------+------------------------------+-----------------------+ | |
| 2324 | 2327 | | round_dance | dancing turtles rotating | compound shapes, clone| | |
| 2325 | 2328 | | | pairwise in opposite | shapesize, tilt, | | |
| 2326 | - | | direction | get_polyshape, update | | ||
| 2329 | + | | direction | get_shapepoly, update | | ||
| 2327 | 2330 | +----------------+------------------------------+-----------------------+ | |
| 2328 | 2331 | | tree | a (graphical) breadth | :func:`clone` | | |
| 2329 | 2332 | | | first tree (using generators)| | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1575,7 +1575,10 @@ def degrees(self, fullcircle=360.0): | |||
| 1575 | 1575 | >>> turtle.left(90) | |
| 1576 | 1576 | >>> turtle.heading() | |
| 1577 | 1577 | 90 | |
| 1578 | - >>> turtle.degrees(400.0) # angle measurement in gon | ||
| 1578 | + | ||
| 1579 | + Change angle measurement unit to grad (also known as gon, | ||
| 1580 | + grade, or gradian and equals 1/100-th of the right angle.) | ||
| 1581 | + >>> turtle.degrees(400.0) | ||
| 1579 | 1582 | >>> turtle.heading() | |
| 1580 | 1583 | 100 | |
| 1581 | 1584 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments