I would like to share a TinyTurtle graphics module I've written for the HP Prime. It is a lightweight implementation of the classic Python turtle module, optimized for the calculator's environment.

The module features two distinct operating modes:
  • Standard Mode: This is the traditional mode where drawing is performed directly on the screen in real time. It allows for control over the drawing speed, making it ideal for animations.
  • Viewport Mode: In this mode, the image is first rendered at maximum speed into a back buffer (ignoring speed commands). Once rendering is complete, the final image is displayed as a whole, allowing the user to scale and pan using single key presses.

There are three built-in grid types to assist with layout:
  • Dotted
  • Square
  • Triangular
Below are a few examples of graphics generated using this library:









Viewport mode example:



Download: http://ceme.tech/DL2776
This is really cool! So glad there's a graphics library that can take advantage of the primes speed.
Version 0.92 introduces several minor fixes and a few new commands from the standard API.

  • tracer() behavior improved to better match the Turtle standard,
  • fixed goto() to support smooth movement (also when not drawing),
  • added methods from the standard API:
    - setworldcoordinates()
    - isdown()
    - setx()
    - sety()
    - teleport()
  • Example files have been included in the archive.

]
Version 0.93:

Key changes
  • reduced memory usage when filling areas while simultaneously drawing the outline with turtle animation enabled (speed ≠ 0),
  • fixed minor issues related to area-filling precision,
  • fixed issues related to wait (reduced battery consumption),
  • improved rendering of the turtle shape (reduced flickering),
  • set the default fill color to black (previously, an error occurred when attempting to fill an area without specifying a color),
  • added the Screen class (simplified version—see the documentation for details).

Added methods from the standard API:
  • delay
  • deegres
  • radians
  • filling
  • window_width
  • window_height
  • getscreen

Additionally, a simple demo application has been added with a basic example (which can be replaced with any of the included files in the Examples folder).
Version 0.94:
  • fixed bug causing simple straight lines to not render correctly in viewport mode (introduced in v0.93),
  • fixed colormode() to fully match standard Python Turtle API (now properly returns current color mode when called without arguments),
  • fixed circle drawing when using negative extent (previously the turtle would move forward instead of backward, and the turtle shape rotated in the opposite direction),
  • added support for custom grid spacing through Turtle constructor,
  • implemented automatic grid hiding when it becomes too dense after scaling,
  • increased maximum viewport scaling steps to ±7 (previously ±5),
  • added safeguards preventing multiple turtles from using/assigning the same buffer,
  • added safeguards against creating Screen object before any Turtle has been instantiated,
  • added aliases bye() and exitonclick() for done().
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement