Python turtle库如何瞬间完成作图?难道只难像海龟一样慢慢爬吗?_turtle瞬间画完(1)

for hand in Second, Minute, Hour:
    hand.shapesize(1, 1, 3)
    hand.speed(0)
Watch = Turtle()
Watch.hideturtle()
Watch.penup()

def Skip(step):
penup()
forward(step)
pendown()

def Create(name, length):
reset()
Skip(-length * 0.1)
begin_poly()
forward(length * 1.1)
end_poly()
handForm = get_poly()
register_shape(name, handForm)

def Write(msg,obj=None):
if obj==‘Watch’:
Watch.write(msg, align=“center”, font=(“Courier”, 14, “bold”))
else:
write(msg, align=“center”, font=(“Courier”, 14, “bold”))

def SetupClock(radius):
reset()
pensize(7)
for i in range(60):
Skip(radius)
if i % 50:
forward(12)
penup()
if i
0:
bk(45); Write(12); fd(45)
elif i30:
bk(20); Write(6); fd(20)
elif i
15 or i45:
bk(30); rt(90)
bk(12 if i
45 else -12)
Write(i//5)
fd(12 if i==45 else -12)
lt(90); fd(30)
pendown()
Skip(-radius - 12)
else:
dot(5)
Skip(-radius)
right(6)
home()
penup()
forward(55)
Write(‘海龟表’)
forward(40)
shape(‘turtle’)

def Week(t):
week = [“一”, “二”, “三”, “四”, “五”, “六”, “日”]
return ‘星期’+week[t.weekday()]

def Date(t):
return “%s-%.2d-%.2d”%(t.year,t.month,t.day)

def Tick():
t = datetime.today()
second = t.second + t.microsecond * 0.000001
minute = t.minute + second / 60.0
hour = t.hour + minute / 60.0
Second.seth(6 * second)
Minute.seth(6 * minute)
Hour.seth(30 * hour)
tracer(False)
Watch.back(100)
Write(Week(t), ‘Watch’)
Watch.forward(30)
Write(Date(t), ‘Watch’)
Watch.home()
tracer(True)
ontimer(Tick, 100)

def main():
tracer(False)
setup(410,400)
bgcolor(‘lightgray’)
title(“Turtle Watch”)
Init()
SetupClock(160)
tracer(True)
Tick()
done()

if name==“main”:

main()

![](https://img-blog.csdnimg.cn/20210921194736908.gif)



### 部分原版帮助


函数实在太多了,除了以上提到过的函数,更多的可调用python自带的原版帮助,help(turtle)总共有8000多行,挑其中一部分放在最后以供参考学习:



import turtle as t
help(t.Pen)
Help on class Turtle in module turtle:

class Turtle(RawTurtle)
| Turtle(shape=‘classic’, undobuffersize=1000, visible=True)
|
| RawTurtle auto-creating (scrolled) canvas.
|
| When a Turtle object is created or a function derived from some
| Turtle method is called a TurtleScreen object is automatically created.
|
| Method resolution order:
| Turtle
| RawTurtle
| TPen
| TNavigator
| builtins.object
|
| Methods defined here:
|
| init(self, shape=‘classic’, undobuffersize=1000, visible=True)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from RawTurtle:
|
| begin_fill(self)
| Called just before drawing a shape to be filled.
|
| No argument.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.color(“black”, “red”)
| >>> turtle.begin_fill()
| >>> turtle.circle(60)
| >>> turtle.end_fill()
|
| begin_poly(self)
| Start recording the vertices of a polygon.
|
| No argument.
|
| Start recording the vertices of a polygon. Current turtle position
| is first point of polygon.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.begin_poly()
|
| clear(self)
| Delete the turtle’s drawings from the screen. Do not move turtle.
|
| No arguments.
|
| Delete the turtle’s drawings from the screen. Do not move turtle.
| State and position of the turtle as well as drawings of other
| turtles are not affected.
|
| Examples (for a Turtle instance named turtle):
| >>> turtle.clear()
|
| clearstamp(self, stampid)
| Delete stamp with given stampid
|
| Argument:
| stampid - an integer, must be return value of previous stamp() call.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.color(“blue”)
| >>> astamp = turtle.stamp()
| >>> turtle.fd(50)
| >>> turtle.clearstamp(astamp)
|
| clearstamps(self, n=None)
| Delete all or first/last n of turtle’s stamps.
|
| Optional argument:
| n – an integer
|
| If n is None, delete all of pen’s stamps,
| else if n > 0 delete first n stamps
| else if n < 0 delete last n stamps.
|
| Example (for a Turtle instance named turtle):
| >>> for i in range(8):
| … turtle.stamp(); turtle.fd(30)
| …
| >>> turtle.clearstamps(2)
| >>> turtle.clearstamps(-2)
| >>> turtle.clearstamps()
|
| clone(self)
| Create and return a clone of the turtle.
|
| No argument.
|
| Create and return a clone of the turtle with same position, heading
| and turtle properties.
|
| Example (for a Turtle instance named mick):
| mick = Turtle()
| joe = mick.clone()
|
| dot(self, size=None, color)
| Draw a dot with diameter size, using color.
|
| Optional arguments:
| size – an integer >= 1 (if given)
| color – a colorstring or a numeric color tuple
|
| Draw a circular dot with diameter size, using color.
| If size is not given, the maximum of pensize+4 and 2
pensize is used.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.dot()
| >>> turtle.fd(50); turtle.dot(20, “blue”); turtle.fd(50)
|
| end_fill(self)
| Fill the shape drawn after the call begin_fill().
|
| No argument.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.color(“black”, “red”)
| >>> turtle.begin_fill()
| >>> turtle.circle(60)
| >>> turtle.end_fill()
|
| end_poly(self)
| Stop recording the vertices of a polygon.
|
| No argument.
|
| Stop recording the vertices of a polygon. Current turtle position is
| last point of polygon. This will be connected with the first point.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.end_poly()
|
| filling(self)
| Return fillstate (True if filling, False else).
|
| No argument.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.begin_fill()
| >>> if turtle.filling():
| … turtle.pensize(5)
| … else:
| … turtle.pensize(3)
|
| get_poly(self)
| Return the lastly recorded polygon.
|
| No argument.
|
| Example (for a Turtle instance named turtle):
| >>> p = turtle.get_poly()
| >>> turtle.register_shape(“myFavouriteShape”, p)
|
| get_shapepoly(self)
| Return the current shape polygon as tuple of coordinate pairs.
|
| No argument.
|
| Examples (for a Turtle instance named turtle):
| >>> turtle.shape(“square”)
| >>> turtle.shapetransform(4, -1, 0, 2)
| >>> turtle.get_shapepoly()
| ((50, -20), (30, 20), (-50, 20), (-30, -20))
|
| getpen = getturtle(self)
|
| getscreen(self)
| Return the TurtleScreen object, the turtle is drawing on.
|
| No argument.
|
| Return the TurtleScreen object, the turtle is drawing on.
| So TurtleScreen-methods can be called for that object.
|
| Example (for a Turtle instance named turtle):
| >>> ts = turtle.getscreen()
| >>> ts
| <turtle.TurtleScreen object at 0x0106B770>
| >>> ts.bgcolor(“pink”)
|
| getturtle(self)
| Return the Turtleobject itself.
|
| No argument.
|
| Only reasonable use: as a function to return the ‘anonymous turtle’:
|
| Example:
| >>> pet = getturtle()
| >>> pet.fd(50)
| >>> pet
| <turtle.Turtle object at 0x0187D810>
| >>> turtles()
| [<turtle.Turtle object at 0x0187D810>]
|
| onclick(self, fun, btn=1, add=None)
| Bind fun to mouse-click event on this turtle on canvas.
|
| Arguments:
| fun – a function with two arguments, to which will be assigned
| the coordinates of the clicked point on the canvas.
| btn – number of the mouse-button defaults to 1 (left mouse button).
| add – True or False. If True, new binding will be added, otherwise
| it will replace a former binding.
|
| Example for the anonymous turtle, i. e. the procedural way:
|
| >>> def turn(x, y):
| … left(360)
| …
| >>> onclick(turn) # Now clicking into the turtle will turn it.
| >>> onclick(None) # event-binding will be removed
|
| ondrag(self, fun, btn=1, add=None)
| Bind fun to mouse-move event on this turtle on canvas.
|
| Arguments:
| fun – a function with two arguments, to which will be assigned
| the coordinates of the clicked point on the canvas.
| btn – number of the mouse-button defaults to 1 (left mouse button).
|
| Every sequence of mouse-move-events on a turtle is preceded by a
| mouse-click event on that turtle.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.ondrag(turtle.goto)
|
| Subsequently clicking and dragging a Turtle will move it
| across the screen thereby producing handdrawings (if pen is
| down).
|
| onrelease(self, fun, btn=1, add=None)
| Bind fun to mouse-button-release event on this turtle on canvas.
|
| Arguments:
| fun – a function with two arguments, to which will be assigned
| the coordinates of the clicked point on the canvas.
| btn – number of the mouse-button defaults to 1 (left mouse button).
|
| Example (for a MyTurtle instance named joe):
| >>> class MyTurtle(Turtle):
| … def glow(self,x,y):
| … self.fillcolor(“red”)
| … def unglow(self,x,y):
| … self.fillcolor(“”)
| …
| >>> joe = MyTurtle()
| >>> joe.onclick(joe.glow)
| >>> joe.onrelease(joe.unglow)
|
| Clicking on joe turns fillcolor red, unclicking turns it to
| transparent.
|
| reset(self)
| Delete the turtle’s drawings and restore its default values.
|
| No argument.
|
| Delete the turtle’s drawings from the screen, re-center the turtle
| and set variables to the default values.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.position()
| (0.00,-22.00)
| >>> turtle.heading()
| 100.0
| >>> turtle.reset()
| >>> turtle.position()
| (0.00,0.00)
| >>> turtle.heading()
| 0.0
|
| settiltangle(self, angle)
| Rotate the turtleshape to point in the specified direction
|
| Argument: angle – number
|
| Rotate the turtleshape to point in the direction specified by angle,
| regardless of its current tilt-angle. DO NOT change the turtle’s
| heading (direction of movement).
|
|
| Examples (for a Turtle instance named turtle):
| >>> turtle.shape(“circle”)
| >>> turtle.shapesize(5,2)
| >>> turtle.settiltangle(45)
| >>> stamp()
| >>> turtle.fd(50)
| >>> turtle.settiltangle(-45)
| >>> stamp()
| >>> turtle.fd(50)
|
| setundobuffer(self, size)
| Set or disable undobuffer.
|
| Argument:
| size – an integer or None
|
| If size is an integer an empty undobuffer of given size is installed.
| Size gives the maximum number of turtle-actions that can be undone
| by the undo() function.
| If size is None, no undobuffer is present.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.setundobuffer(42)
|
| shape(self, name=None)
| Set turtle shape to shape with given name / return current shapename.
|
| Optional argument:
| name – a string, which is a valid shapename
|
| Set turtle shape to shape with given name or, if name is not given,
| return name of current shape.
| Shape with name must exist in the TurtleScreen’s shape dictionary.
| Initially there are the following polygon shapes:
| ‘arrow’, ‘turtle’, ‘circle’, ‘square’, ‘triangle’, ‘classic’.
| To learn about how to deal with shapes see Screen-method register_shape.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.shape()
| ‘arrow’
| >>> turtle.shape(“turtle”)
| >>> turtle.shape()
| ‘turtle’
|
| shapesize(self, stretch_wid=None, stretch_len=None, outline=None)
| Set/return turtle’s stretchfactors/outline. Set resizemode to “user”.
|
| Optional arguments:
| stretch_wid : positive number
| stretch_len : positive number
| outline : positive number
|
| Return or set the pen’s attributes x/y-stretchfactors and/or outline.
| Set resizemode to “user”.
| If and only if resizemode is set to “user”, the turtle will be displayed
| stretched according to its stretchfactors:
| stretch_wid is stretchfactor perpendicular to orientation
| stretch_len is stretchfactor in direction of turtles orientation.
| outline determines the width of the shapes’s outline.
|
| Examples (for a Turtle instance named turtle):
| >>> turtle.resizemode(“user”)
| >>> turtle.shapesize(5, 5, 12)
| >>> turtle.shapesize(outline=8)
|
| shapetransform(self, t11=None, t12=None, t21=None, t22=None)
| Set or return the current transformation matrix of the turtle shape.
|
| Optional arguments: t11, t12, t21, t22 – numbers.
|
| If none of the matrix elements are given, return the transformation
| matrix.
| Otherwise set the given elements and transform the turtleshape
| according to the matrix consisting of first row t11, t12 and
| second row t21, 22.
| Modify stretchfactor, shearfactor and tiltangle according to the
| given matrix.
|
| Examples (for a Turtle instance named turtle):
| >>> turtle.shape(“square”)
| >>> turtle.shapesize(4,2)
| >>> turtle.shearfactor(-0.5)
| >>> turtle.shapetransform()
| (4.0, -1.0, -0.0, 2.0)
|
| shearfactor(self, shear=None)
| Set or return the current shearfactor.
|
| Optional argument: shear – number, tangent of the shear angle
|
| Shear the turtleshape according to the given shearfactor shear,
| which is the tangent of the shear angle. DO NOT change the
| turtle’s heading (direction of movement).
| If shear is not given: return the current shearfactor, i. e. the
| tangent of the shear angle, by which lines parallel to the
| heading of the turtle are sheared.
|
| Examples (for a Turtle instance named turtle):
| >>> turtle.shape(“circle”)
| >>> turtle.shapesize(5,2)
| >>> turtle.shearfactor(0.5)
| >>> turtle.shearfactor()
| >>> 0.5
|
| stamp(self)
| Stamp a copy of the turtleshape onto the canvas and return its id.
|
| No argument.
|
| Stamp a copy of the turtle shape onto the canvas at the current
| turtle position. Return a stamp_id for that stamp, which can be
| used to delete it by calling clearstamp(stamp_id).
|
| Example (for a Turtle instance named turtle):
| >>> turtle.color(“blue”)
| >>> turtle.stamp()
| 13
| >>> turtle.fd(50)
|
| tilt(self, angle)
| Rotate the turtleshape by angle.
|
| Argument:
| angle - a number
|
| Rotate the turtleshape by angle from its current tilt-angle,
| but do NOT change the turtle’s heading (direction of movement).
|
| Examples (for a Turtle instance named turtle):
| >>> turtle.shape(“circle”)
| >>> turtle.shapesize(5,2)
| >>> turtle.tilt(30)
| >>> turtle.fd(50)
| >>> turtle.tilt(30)
| >>> turtle.fd(50)
|
| tiltangle(self, angle=None)
| Set or return the current tilt-angle.
|
| Optional argument: angle – number
|
| Rotate the turtleshape to point in the direction specified by angle,
| regardless of its current tilt-angle. DO NOT change the turtle’s
| heading (direction of movement).
| If angle is not given: return the current tilt-angle, i. e. the angle
| between the orientation of the turtleshape and the heading of the
| turtle (its direction of movement).
|
| Deprecated since Python 3.1
|
| Examples (for a Turtle instance named turtle):
| >>> turtle.shape(“circle”)
| >>> turtle.shapesize(5,2)
| >>> turtle.tilt(45)
| >>> turtle.tiltangle()
|
| turtlesize = shapesize(self, stretch_wid=None, stretch_len=None, outline=None)
|
| undo(self)
| undo (repeatedly) the last turtle action.
|
| No argument.
|
| undo (repeatedly) the last turtle action.
| Number of available undo actions is determined by the size of
| the undobuffer.
|
| Example (for a Turtle instance named turtle):
| >>> for i in range(4):
| … turtle.fd(50); turtle.lt(80)
| …
| >>> for i in range(8):
| … turtle.undo()
| …
|
| undobufferentries(self)
| Return count of entries in the undobuffer.
|
| No argument.
|
| Example (for a Turtle instance named turtle):
| >>> while undobufferentries():
| … undo()
|
| write(self, arg, move=False, align=‘left’, font=(‘Arial’, 8, ‘normal’))
| Write text at the current turtle position.
|
| Arguments:
| arg – info, which is to be written to the TurtleScreen
| move (optional) – True/False
| align (optional) – one of the strings “left”, “center” or right"
| font (optional) – a triple (fontname, fontsize, fonttype)
|
| Write text - the string representation of arg - at the current
| turtle position according to align (“left”, “center” or right")
| and with the given font.
| If move is True, the pen is moved to the bottom-right corner
| of the text. By default, move is False.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.write(‘Home = ‘, True, align=“center”)
| >>> turtle.write((0,0), True)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from RawTurtle:
|
| screens = []
|
| ----------------------------------------------------------------------
| Methods inherited from TPen:
|
| color(self, *args)
| Return or set the pencolor and fillcolor.
|
| Arguments:
| Several input formats are allowed.
| They use 0, 1, 2, or 3 arguments as follows:
|
| color()
| Return the current pencolor and the current fillcolor
| as a pair of color specification strings as are returned
| by pencolor and fillcolor.
| color(colorstring), color((r,g,b)), color(r,g,b)
| inputs as in pencolor, set both, fillcolor and pencolor,
| to the given value.
| color(colorstring1, colorstring2),
| color((r1,g1,b1), (r2,g2,b2))
| equivalent to pencolor(colorstring1) and fillcolor(colorstring2)
| and analogously, if the other input format is used.
|
| If turtleshape is a polygon, outline and interior of that polygon
| is drawn with the newly set colors.
| For more info see: pencolor, fillcolor
|
| Example (for a Turtle instance named turtle):
| >>> turtle.color(‘red’, ‘green’)
| >>> turtle.color()
| (‘red’, ‘green’)
| >>> colormode(255)
| >>> color((40, 80, 120), (160, 200, 240))
| >>> color()
| (’#285078’, ‘#a0c8f0’)
|
| down = pendown(self)
|
| fillcolor(self, *args)
| Return or set the fillcolor.
|
| Arguments:
| Four input formats are allowed:
| - fillcolor()
| Return the current fillcolor as color specification string,
| possibly in hex-number format (see example).
| May be used as input to another color/pencolor/fillcolor call.
| - fillcolor(colorstring)
| s is a Tk color specification string, such as “red” or “yellow”
| - fillcolor((r, g, b))
| a tuple of r, g, and b, which represent, an RGB color,
| and each of r, g, and b are in the range 0…colormode,
| where colormode is either 1.0 or 255
| - fillcolor(r, g, b)
| r, g, and b represent an RGB color, and each of r, g, and b
| are in the range 0…colormode
|
| If turtleshape is a polygon, the interior of that polygon is drawn
| with the newly set fillcolor.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.fillcolor(‘violet’)
| >>> col = turtle.pencolor()
| >>> turtle.fillcolor(col)
| >>> turtle.fillcolor(0, .5, 0)
|
| hideturtle(self)
| Makes the turtle invisible.
|
| Aliases: hideturtle | ht
|
| No argument.
|
| It’s a good idea to do this while you’re in the
| middle of a complicated drawing, because hiding
| the turtle speeds up the drawing observably.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.hideturtle()
|
| ht = hideturtle(self)
|
| isdown(self)
| Return True if pen is down, False if it’s up.
|
| No argument.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.penup()
| >>> turtle.isdown()
| False
| >>> turtle.pendown()
| >>> turtle.isdown()
| True
|
| isvisible(self)
| Return True if the Turtle is shown, False if it’s hidden.
|
| No argument.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.hideturtle()
| >>> print turtle.isvisible():
| False
|
| pd = pendown(self)
|
| pen(self, pen=None, **pendict)
| Return or set the pen’s attributes.
|
| Arguments:
| pen – a dictionary with some or all of the below listed keys.
| **pendict – one or more keyword-arguments with the below
| listed keys as keywords.
|
| Return or set the pen’s attributes in a ‘pen-dictionary’
| with the following key/value pairs:
| “shown” : True/False
| “pendown” : True/False
| “pencolor” : color-string or color-tuple
| “fillcolor” : color-string or color-tuple
| “pensize” : positive number
| “speed” : number in range 0…10
| “resizemode” : “auto” or “user” or “noresize”
| “stretchfactor”: (positive number, positive number)
| “shearfactor”: number
| “outline” : positive number
| “tilt” : number
|
| This dictionary can be used as argument for a subsequent
| pen()-call to restore the former pen-state. Moreover one
| or more of these attributes can be provided as keyword-arguments.
| This can be used to set several pen attributes in one statement.
|
|
| Examples (for a Turtle instance named turtle):
| >>> turtle.pen(fillcolor=“black”, pencolor=“red”, pensize=10)
| >>> turtle.pen()
| {‘pensize’: 10, ‘shown’: True, ‘resizemode’: ‘auto’, ‘outline’: 1,
| ‘pencolor’: ‘red’, ‘pendown’: True, ‘fillcolor’: ‘black’,
| ‘stretchfactor’: (1,1), ‘speed’: 3, ‘shearfactor’: 0.0}
| >>> penstate=turtle.pen()
| >>> turtle.color(“yellow”,“”)
| >>> turtle.penup()
| >>> turtle.pen()
| {‘pensize’: 10, ‘shown’: True, ‘resizemode’: ‘auto’, ‘outline’: 1,
| ‘pencolor’: ‘yellow’, ‘pendown’: False, ‘fillcolor’: ‘’,
| ‘stretchfactor’: (1,1), ‘speed’: 3, ‘shearfactor’: 0.0}
| >>> p.pen(penstate, fillcolor=“green”)
| >>> p.pen()
| {‘pensize’: 10, ‘shown’: True, ‘resizemode’: ‘auto’, ‘outline’: 1,
| ‘pencolor’: ‘red’, ‘pendown’: True, ‘fillcolor’: ‘green’,
| ‘stretchfactor’: (1,1), ‘speed’: 3, ‘shearfactor’: 0.0}
|
| pencolor(self, *args)
| Return or set the pencolor.
|
| Arguments:
| Four input formats are allowed:
| - pencolor()
| Return the current pencolor as color specification string,
| possibly in hex-number format (see example).
| May be used as input to another color/pencolor/fillcolor call.
| - pencolor(colorstring)
| s is a Tk color specification string, such as “red” or “yellow”
| - pencolor((r, g, b))
| a tuple of r, g, and b, which represent, an RGB color,
| and each of r, g, and b are in the range 0…colormode,
| where colormode is either 1.0 or 255
| - pencolor(r, g, b)
| r, g, and b represent an RGB color, and each of r, g, and b
| are in the range 0…colormode
|
| If turtleshape is a polygon, the outline of that polygon is drawn
| with the newly set pencolor.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.pencolor(‘brown’)
| >>> tup = (0.2, 0.8, 0.55)
| >>> turtle.pencolor(tup)
| >>> turtle.pencolor()
| ‘#33cc8c’
|
| pendown(self)
| Pull the pen down – drawing when moving.
|
| Aliases: pendown | pd | down
|
| No argument.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.pendown()
|
| pensize(self, width=None)
| Set or return the line thickness.
|
| Aliases: pensize | width
|
| Argument:
| width – positive number
|
| Set the line thickness to width or return it. If resizemode is set
| to “auto” and turtleshape is a polygon, that polygon is drawn with
| the same line thickness. If no argument is given, current pensize
| is returned.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.pensize()
| 1
| >>> turtle.pensize(10) # from here on lines of width 10 are drawn
|
| penup(self)
| Pull the pen up – no drawing when moving.
|
| Aliases: penup | pu | up
|
| No argument
|
| Example (for a Turtle instance named turtle):
| >>> turtle.penup()
|
| pu = penup(self)
|
| resizemode(self, rmode=None)
| Set resizemode to one of the values: “auto”, “user”, “noresize”.
|
| (Optional) Argument:
| rmode – one of the strings “auto”, “user”, “noresize”
|
| Different resizemodes have the following effects:
| - “auto” adapts the appearance of the turtle
| corresponding to the value of pensize.
| - “user” adapts the appearance of the turtle according to the
| values of stretchfactor and outlinewidth (outline),
| which are set by shapesize()
| - “noresize” no adaption of the turtle’s appearance takes place.
| If no argument is given, return current resizemode.
| resizemode(“user”) is called by a call of shapesize with arguments.
|
|
| Examples (for a Turtle instance named turtle):
| >>> turtle.resizemode(“noresize”)
| >>> turtle.resizemode()
| ‘noresize’
|
| showturtle(self)
| Makes the turtle visible.
|
| Aliases: showturtle | st
|
| No argument.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.hideturtle()
| >>> turtle.showturtle()
|
| speed(self, speed=None)
| Return or set the turtle’s speed.
|
| Optional argument:
| speed – an integer in the range 0…10 or a speedstring (see below)
|
| Set the turtle’s speed to an integer value in the range 0 … 10.
| If no argument is given: return current speed.
|
| If input is a number greater than 10 or smaller than 0.5,
| speed is set to 0.
| Speedstrings are mapped to speedvalues in the following way:
| ‘fastest’ : 0
| ‘fast’ : 10
| ‘normal’ : 6
| ‘slow’ : 3
| ‘slowest’ : 1
| speeds from 1 to 10 enforce increasingly faster animation of
| line drawing and turtle turning.
|
| Attention:
| speed = 0 : no animation takes place. forward/back makes turtle jump
| and likewise left/right make the turtle turn instantly.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.speed(3)
|
| st = showturtle(self)
|
| up = penup(self)
|
| width = pensize(self, width=None)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from TPen:
|
| dict
| dictionary for instance variables (if defined)
|
| weakref
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Methods inherited from TNavigator:
|
| back(self, distance)
| Move the turtle backward by distance.
|
| Aliases: back | backward | bk
|
| Argument:
| distance – a number
|
| Move the turtle backward by distance ,opposite to the direction the
| turtle is headed. Do not change the turtle’s heading.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.position()
| (0.00, 0.00)
| >>> turtle.backward(30)
| >>> turtle.position()
| (-30.00, 0.00)
|
| backward = back(self, distance)
|
| bk = back(self, distance)
|
| circle(self, radius, extent=None, steps=None)
| Draw a circle with given radius.
|
| Arguments:
| radius – a number
| extent (optional) – a number
| steps (optional) – an integer
|
| Draw a circle with given radius. The center is radius units left
| of the turtle; extent - an angle - determines which part of the
| circle is drawn. If extent is not given, draw the entire circle.
| If extent is not a full circle, one endpoint of the arc is the
| current pen position. Draw the arc in counterclockwise direction
| if radius is positive, otherwise in clockwise direction. Finally
| the direction of the turtle is changed by the amount of extent.
学好 Python 不论是就业还是做副业赚钱都不错,但要学会 Python 还是要有一个学习规划。最后大家分享一份全套的 Python 学习资料,给那些想学习 Python 的小伙伴们一点帮助!

一、Python所有方向的学习路线

Python所有方向路线就是把Python常用的技术点做整理,形成各个领域的知识点汇总,它的用处就在于,你可以按照上面的知识点去找对应的学习资源,保证自己学得较为全面。

二、学习软件

工欲善其事必先利其器。学习Python常用的开发软件都在这里了,给大家节省了很多时间。

三、全套PDF电子书

书籍的好处就在于权威和体系健全,刚开始学习的时候你可以只看视频或者听某个人讲课,但等你学完之后,你觉得你掌握了,这时候建议还是得去看一下书籍,看权威技术书籍也是每个程序员必经之路。

四、入门学习视频

我们在看视频学习的时候,不能光动眼动脑不动手,比较科学的学习方法是在理解之后运用它们,这时候练手项目就很适合了。

五、实战案例

光学理论是没用的,要学会跟着一起敲,要动手实操,才能将自己的所学运用到实际当中去,这时候可以搞点实战案例来学习。

六、面试资料

我们学习Python必然是为了找到高薪的工作,下面这些面试题是来自阿里、腾讯、字节等一线互联网大厂最新的面试资料,并且有阿里大佬给出了权威的解答,刷完这一套面试资料相信大家都能找到满意的工作。

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里无偿获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  • 25
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值