[Python-Dev] turtle.py update for 3.1 (original) (raw)

Gregor Lingl gregor.lingl at aon.at
Mon May 4 16:33:58 CEST 2009


Hi,

Encouraged by a conversation with Martin at PyCon 2009 I've prepared a version 1.1b of the turtle module and I'd like to get some advice or assistance to get it into the beta as explained below. Thus I'd appreciate very much if also the release manager would take notice of this posting.

python 2.0 had the version 1.0 and for now I'll give a terse summary of the changes I did:

  1. a few bugfixes, with 1 - 5 lines of code changed for each; these concern bugs that prevented turtle to run correctly

  2. I've added four methods to the class TurtleScreeenBase: _onkeypress(fun, key) (supplementing _onkeyrelease) mainloop() (which is now a Screen-method and a function) textinput(title, prompt) numinput(title, prompt, default, minval, maxval) the latter two remedy the complete lack of input methods _onkey, an internal method name is changed to _onkeyrelease

  3. I've added one method to the class TurtleScreen: onkeypress(fun, key=None) implemented in analogy to the already present onkey() which got onkeyrelease as an alias.

  4. I've changed several portions of the code that affect the representation of the turtleshape thus making it more compact (by removing some duplicated code) and more powerful, i. e. by adding the possibility to apply shearings to turtleshapes (in addition to the already present scaling and rotating transformations). Thus now the full range of (non singular) linear transformations is available.

    New methods in class RawTurtle: shearfactor(shear=None) set or get the shearfactor shapetransform(t11, t12, t21, t22) set or get the shape transform directly get_shapepoly() return the polygon of the current shape

    I've enhanced the functionality of tiltangle(angle=None) to contain also that of settiltangle and I propose to declare settiltangle as deprecated.

  5. I've removed a lot of codelines that were commented out during the process of transferring the module from 2.6 to 3.0

  6. I've implemented the bugfix for http://bugs.python.org/issue4117 according do my proposition there and I strongly recommend this change again, as the bug described is very annoying, the fix is easy and no one proposed a better solution.

  7. I've tested the present version 1.1 extensivly. It runs all the demo scripts without problems and many others too (some of them significantly better than version 1.1). I'd like to add two additional scripts to the demo directory, one of them using new features so it only runs with this new version.

I've not touched the issue of the Screen singleton, so that remains unchanged as it was as a result of Martins patch.

Thus, as a summary, this update does some bugfixes and eliminates three deficiencies of the module: (1) accept keypress event, (2) provide user input functions and (3) complement scaling and rotating of turtleshapes by shearing, thus providing the full range of linear transforms.

HOW TO PROCEED NOW?

(1) Submit the new version as a single file (2) submit a unified diff containing all the changes (3) Divide the changes into several chunks of related changes and submit the according diffs separately That would pose the problems, that there are lines in the code that are affected by several changes, e. g. those lines that define all And also: does the order of applying the patches matter? How do I have to account for this? (4) Some other approach?

I'd appreciate to discuss open issues as needed and I'm prepared to give more elaborate explanations and rationales as wanted or as needed.

Docs for the changes are (to a large extent) contained in the docstrings and I'm going to update the Documentation of the turtle module (on the basis of theses docstrings) now.

Thanks in advance for your support

Gregor



More information about the Python-Dev mailing list