turtle.penup()

turtle.penup() turtle.pu() turtle.up() Pull the pen up – no drawing when moving.

turtle.pensize()

turtle.pensize(width=None) turtle.width(width=None) Parameters: width – a 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, the current pensize is returned. >>> turtle.pensize() 1 >>> turtle.pensize(10) # from here on lines of width 10 are drawn

turtle.pendown()

turtle.pendown() turtle.pd() turtle.down() Pull the pen down – drawing when moving.

turtle.pencolor()

turtle.pencolor(*args) Return or set the pencolor. Four input formats are allowed: pencolor() Return the current pencolor as color specification string or as a tuple (see example). May be used as input to another color/pencolor/fillcolor call. pencolor(colorstring) Set pencolor to colorstring, which is a Tk color specification string, such as "red", "yellow", or "#33cc8c". pencolor((r, g, b)) Set pencolor to the RGB color represented by the tuple of r, g, and b. Each of r, g, and b mus

turtle.pen()

turtle.pen(pen=None, **pendict) Parameters: 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” o

turtle.pd()

turtle.pd() turtle.down() Pull the pen down – drawing when moving.

turtle.ontimer()

turtle.ontimer(fun, t=0) Parameters: fun – a function with no arguments t – a number >= 0 Install a timer that calls fun after t milliseconds. >>> running = True >>> def f(): ... if running: ... fd(50) ... lt(60) ... screen.ontimer(f, 250) >>> f() ### makes the turtle march around >>> running = False

turtle.onscreenclick()

turtle.onscreenclick(fun, btn=1, add=None) Parameters: fun – a function with two arguments which will be called with the coordinates of the clicked point on the canvas num – number of the mouse-button, defaults to 1 (left mouse button) add – True or False – if True, a new binding will be added, otherwise it will replace a former binding Bind fun to mouse-click events on this screen. If fun is None, existing bindings are removed. Example for a TurtleScreen instance named screen and a T

turtle.onrelease()

turtle.onrelease(fun, btn=1, add=None) Parameters: fun – a function with two arguments which will be called with the coordinates of the clicked point on the canvas num – number of the mouse-button, defaults to 1 (left mouse button) add – True or False – if True, a new binding will be added, otherwise it will replace a former binding Bind fun to mouse-button-release events on this turtle. If fun is None, existing bindings are removed. >>> class MyTurtle(Turtle): ... def gl

turtle.onkeyrelease()

turtle.onkeyrelease(fun, key) Parameters: fun – a function with no arguments or None key – a string: key (e.g. “a”) or key-symbol (e.g. “space”) Bind fun to key-release event of key. If fun is None, event bindings are removed. Remark: in order to be able to register key-events, TurtleScreen must have the focus. (See method listen().) >>> def f(): ... fd(50) ... lt(60) ... >>> screen.onkey(f, "Up") >>> screen.listen()