turtle.TurtleScreen

class turtle.TurtleScreen(cv, mode='standard', colormode=1.0, delay=10)[source]

Provides screen oriented methods like setbg etc.

Only relies upon the methods of TurtleScreenBase and NOT upon components of the underlying graphics toolkit - which is Tkinter in this case.

Methods

__format__ default object formatter
__init__(cv[, mode, colormode, delay])
__new__((S, ...)
__reduce__ helper for pickle
__reduce_ex__ helper for pickle
__sizeof__(() -> int) size of object in memory, in bytes
__subclasshook__ Abstract classes can override this to customize issubclass().
_bgcolor([color]) Set canvas’ backgroundcolor if color is not None, else return backgroundcolor.
_blankimage() return a blank image object
_color(cstr)
_colorstr(color) Return color string corresponding to args.
_createimage(image) Create and return image item on canvas.
_createline() Create an invisible line item on canvas self.cv)
_createpoly() Create an invisible polygon item on canvas self.cv)
_delay(delay) Delay subsequent canvas actions for delay ms.
_delete(item) Delete graphics item from canvas.
_drawimage(item, (x, y), image) Configure image item as to draw image object
_drawline(lineitem[, coordlist, fill, ...]) Configure lineitem according to provided arguments: coordlist is sequence of coordinates fill is drawing color width is width of drawn line.
_drawpoly(polyitem, coordlist[, fill, ...]) Configure polygonitem polyitem according to provided arguments: coordlist is sequence of coordinates fill is filling color outline is outline color top is a boolean value, which specifies if polyitem will be put on top of the canvas’ displaylist so it will not be covered by other items.
_image(filename) return an image object containing the
_incrementudc() Increment update counter.
_iscolorstring(color) Check if the string color is a legal Tkinter color string.
_listen() Set focus on canvas (in order to collect key-events)
_onclick(item, fun[, num, add]) Bind fun to mouse-click event on turtle.
_ondrag(item, fun[, num, add]) Bind fun to mouse-move-event (with pressed mouse button) on turtle.
_onkey(fun, key) Bind fun to key-release event of key.
_onrelease(item, fun[, num, add]) Bind fun to mouse-button-release event on turtle.
_onscreenclick(fun[, num, add]) Bind fun to mouse-click event on canvas.
_ontimer(fun, t) Install a timer, which calls fun after t milliseconds.
_pointlist(item) returns list of coordinate-pairs of points of item
_rescale(xscalefactor, yscalefactor)
_resize([canvwidth, canvheight, bg]) Resize the canvas the turtles are drawing on.
_setbgpic(item, image) Configure image item as to draw image object at center of canvas.
_setscrollregion(srx1, sry1, srx2, sry2)
_type(item) Return ‘line’ or ‘polygon’ or ‘image’ depending on type of item.
_update() Redraw graphics items on canvas
_window_size() Return the width and height of the turtle window.
_write(pos, txt, align, font, pencolor) Write txt at pos in canvas with specified font and color.
addshape(name[, shape]) Adds a turtle shape to TurtleScreen’s shapelist.
bgcolor(*args) Set or return backgroundcolor of the TurtleScreen.
bgpic([picname]) Set background image or return name of current backgroundimage.
clear() Delete all drawings and all turtles from the TurtleScreen.
clearscreen() Delete all drawings and all turtles from the TurtleScreen.
colormode([cmode]) Return the colormode or set it to 1.0 or 255.
delay([delay]) Return or set the drawing delay in milliseconds.
getcanvas() Return the Canvas of this TurtleScreen.
getshapes() Return a list of names of all currently available turtle shapes.
listen([xdummy, ydummy]) Set focus on TurtleScreen (in order to collect key-events)
mode([mode]) Set turtle-mode (‘standard’, ‘logo’ or ‘world’) and perform reset.
onclick(fun[, btn, add]) Bind fun to mouse-click event on canvas.
onkey(fun, key) Bind fun to key-release event of key.
onscreenclick(fun[, btn, add]) Bind fun to mouse-click event on canvas.
ontimer(fun[, t]) Install a timer, which calls fun after t milliseconds.
register_shape(name[, shape]) Adds a turtle shape to TurtleScreen’s shapelist.
reset() Reset all Turtles on the Screen to their initial state.
resetscreen() Reset all Turtles on the Screen to their initial state.
screensize([canvwidth, canvheight, bg]) Resize the canvas the turtles are drawing on.
setworldcoordinates(llx, lly, urx, ury) Set up a user defined coordinate-system.
tracer([n, delay]) Turns turtle animation on/off and set delay for update drawings.
turtles() Return the list of turtles on the screen.
update() Perform a TurtleScreen update.
window_height() Return the height of the turtle window.
window_width() Return the width of the turtle window.