~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Lib/lib-tk/turtle.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-10-03 12:03:05 UTC
  • mto: (10.1.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 32.
  • Revision ID: james.westby@ubuntu.com-20091003120305-hij6yssh0figh590
Tags: upstream-2.6.3
ImportĀ upstreamĀ versionĀ 2.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#
2
2
# turtle.py: a Tkinter based turtle graphics module for Python
3
 
# Version 1.0b1 - 31. 5. 2008
 
3
# Version 1.0.1 - 24. 9. 2009
4
4
#
5
 
# Copyright (C) 2006 - 2008  Gregor Lingl
 
5
# Copyright (C) 2006 - 2009  Gregor Lingl
6
6
# email: glingl@aon.at
7
7
#
8
8
# This software is provided 'as-is', without any express or implied
1244
1244
    def update(self):
1245
1245
        """Perform a TurtleScreen update.
1246
1246
        """
 
1247
        tracing = self._tracing
 
1248
        self._tracing = True
1247
1249
        for t in self.turtles():
1248
1250
            t._update_data()
1249
1251
            t._drawturtle()
 
1252
        self._tracing = tracing
1250
1253
        self._update()
1251
1254
 
1252
1255
    def window_width(self):
1337
1340
        ### consequently drawing a hexagon
1338
1341
        """
1339
1342
        if fun == None:
1340
 
            self._keys.remove(key)
 
1343
            if key in self._keys:
 
1344
                self._keys.remove(key)
1341
1345
        elif key not in self._keys:
1342
1346
            self._keys.append(key)
1343
1347
        self._onkey(fun, key)
2794
2798
 
2795
2799
    def _drawturtle(self):
2796
2800
        """Manages the correct rendering of the turtle with respect to
2797
 
        its shape, resizemode, strech and tilt etc."""
 
2801
        its shape, resizemode, stretch and tilt etc."""
2798
2802
        screen = self.screen
2799
2803
        shape = screen._shapes[self.turtle.shapeIndex]
2800
2804
        ttype = shape._type
3574
3578
            topbottom = _CFG["topbottom"]
3575
3579
            self._root.setupcanvas(width, height, canvwidth, canvheight)
3576
3580
            _Screen._canvas = self._root._getcanvas()
 
3581
            TurtleScreen.__init__(self, _Screen._canvas)
3577
3582
            self.setup(width, height, leftright, topbottom)
3578
 
        TurtleScreen.__init__(self, _Screen._canvas)
3579
3583
 
3580
3584
    def setup(self, width=_CFG["width"], height=_CFG["height"],
3581
3585
              startx=_CFG["leftright"], starty=_CFG["topbottom"]):
3615
3619
        if starty is None:
3616
3620
            starty = (sh - height) / 2
3617
3621
        self._root.set_geometry(width, height, startx, starty)
 
3622
        self.update()
3618
3623
 
3619
3624
    def title(self, titlestring):
3620
3625
        """Set title of turtle-window