|
From: Kevin A. <al...@se...> - 2001-10-15 02:00:23
|
The new turtle.py module and conversion of the turtle sample are now in cvs.
I did not change the name of the turtle sample, since PythonCardPrototype is
a package, there is not a name conflict as long as you are explicit with the
import statement. Here's the output in the shell from the new pycrustrc.py
file:
>>> from PythonCardPrototype.turtle import BitmapTurtle
>>> t = BitmapTurtle(bg.components.bufOff)
'bufOff' is a BitmapCanvas widget I added to the turtle.rsrc.py file. I had
to modify a number of scripts so that the window is explicitly refreshed
rather than always auto-refreshed to improve performance. I will be making
additional tweaks for performance as the BitmapTurtle and BitmapCanvas
classes continue to evolve. Suggestions on any aspect of the turtle are
welcome as always.
The turtle commands haven't changed, so you can still do stuff in the shell
like:
>>> t.st()
>>> t.color('blue')
>>> for i in range(6):
... t.left(60)
... t.fd(50)
Now that there is a turtle module, you can use a turtle anywhere you have a
BitmapCanvas and you can subclass the BitmapTurtle class if you want to
change or add functionality.
The big addition/change I still need to make is a wrapped wxPen class. I'll
post more info as changes are checked in.
ka
> -----Original Message-----
> From: pyt...@li...
> [mailto:pyt...@li...]On Behalf Of Kevin
> Altis
> Sent: Friday, October 12, 2001 8:08 PM
> To: pythoncard-Users
> Subject: [Pythoncard-users] turtle sample migrating to use BitmapCanvas
>
>
> I'm in the process of converting the turtle sample to use the BitmapCanvas
> widget. I haven't checked the changes into cvs yet, but I expect
> to have the
> conversion done sometime this weekend. The reason I'm posting this message
> now rather than when I'm done is in case some people on the list are using
> the existing turtle sample and want to get their input in while
> I'm working
> on this.
>
> The big change is that there will be a new turtle module that contains an
> AbstractTurtle and BitmapTurtle class. The aTurtle.py and wxTurtle.py
> modules in the turtle sample directory will be removed.
>
> The BitmapTurtle uses a BitmapCanvas widget rather than directly
> drawing on
> a wxPython device context (DC). The drawing time is slower than
> before, but
> all the drawing is buffered, so the bitmap is no longer lost if the turtle
> window is obscured or minimized. In addition, Auto Refresh can be
> turned off
> to get a dramatic speed improvement, you just won't see the
> drawing until it
> is completed.
>
> You can still have any number of turtles you want, so the turtle is a good
> way of doing artificial life experiments. If you want to get fancy you can
> have multiple BitmapCanvas widgets in a window and multiple turtles per
> BitmapCanvas. The turtle(s) can still be driven from the shell. Once the
> change is complete I can start looking at expanding the coordinate system,
> so each turtle can have its own units of measurement, scale, etc. The end
> result should be a system that is very flexible and powerful.
>
> I will have to fix a few of the existing scripts to work with the
> new setup
> and this also gives me some incentive to get back to the
> BitmapCanvas widget
> and wrap up the wxPython wxPen and wxBrush, etc.
>
> I kept the AbstractTurtle class so that in the future we can still have a
> PostScriptTurtle or other varieties.
>
> ka
>
>
> _______________________________________________
> Pythoncard-users mailing list
> Pyt...@li...
> https://lists.sourceforge.net/lists/listinfo/pythoncard-users
>
|