curser

Introduction

curser is a python module, for Linux and Windows, based on and complementary to pygame.

curser will give you analog functions as the turtle module implement in a pygame display to make easier the generation and the animation of forms like polygons, spirals, fractals and so soon.
With abstraction of the coordinates computing through an curser object analog to the turtle whose orientation is adjustable through rotation functions (to the left or to the right) from the number of wanted degrees with progressiv animated stroke drawing or not animated functions whose color and width is configurable.

Screenshots of usage examples from the curser module:

Description:

Instanciate the Curser class with the following arguments:


turtle=Curser(start_x=800/2, start_y=600/2, start_angle=0, color=(0,0,0),
              bg_color=(255,255,255), stroke_width=1, curser_down=True)

to get an curser object who implement the following methods to drawing:


turtle.mv_forward(px)           # Move the curser forward in the current direction from px pixels.

turtle.mv_backward(px)          # Move the curser backward in the opposite direction to the current from px pixels.

turtle.mv_left(degrees)         # Turn the curser left from argument degrees degrees and update the current direction.

turtle.mv_right(degrees)        # Turn the curser right from argument degrees degrees and update the current direction.

turtle.anim_forward(px,speed)   # Move the curser forward in current direction from one pixel every speed seconds (or fraction) from px pixels
                                # far what create an stroke drawning animation effect.

turtle.anim_backward(px,speed)  # Move the curser backward in the opposite direction from one pixel every speed seconds (or fraction) from px pixels
                                # far what create an stroke drawning animation effect.

turtle.get_coords_forward(px)   # Return the coordinates for a forward moving result from px pixels without drawing a stroke or move the curser.
                                # ! Use this method with your own coordinates container.

turtle.get_coords_backward(px)  # Return the coordinates for a backward moving result from px pixels without drawing a stroke or move the curser.
                                # ! Use this method with your own coordinates container.

turtle.get_curser_pos()         # Return the current curser position as (x,y).

turtle.show_hook()              # Hook method to set in the pygame mainloop if you use it, this is the core for displaying the curser and the driven strokes.

turtle.curser_up()              # Raise the curser up and any curser moving method will not draw but the direction changings are effectiv.
                                # ! This method does not hide the curser.

turtle.curser_down()            # Put the curser down any moving method will draw on the display.
                                # ! This method do not show the curser if he is hidden.

turtle.hide_curser()            # Hide the curser but does not raise him up is simply to hide the curser for driving.

turtle.show_curser()            # Show the curser but does not put him down.
                                # ! The curser is visible per default.

turtle.set_bg_color(bg_color)   # Change the display background
                                # ! You have to set the show_hook() method in the mainloop to make it effectiv if you work with it.

turtle.get_bg_color()           # Return the current display background color as (red,green,blue) tuple.

turtle.set_curser_pos(x, y)     # Set the curser position to the coordinates x,y

turtle.set_stroke_color(color)  # Set stroke and curser color to the argument color who must be an 3-elements tuple (red,green,blue)

turtle.get_stroke_color()       # Return the current stroke and curser color as (red,green,blue) tuple.

turtle.set_stroke_width(stroke_width)  # Set the stroke width to the stroke_width argument in pixels.
                                       # ! The curser size will increase or decrease if you change the stroke width.

turtle.get_stroke_width()       # Return the current stroke width in pixels.



Import of the curser module:


################################################################################################
#                                   import directives                                          #
################################################################################################
#                                                                                              #
#        import the module with the import directive:                                          #
#                                                                                              #
#        ###########################################################################           #
#        # Python 2.7.3 (default, Apr 20 2012, 22:39:59)                           #           #
#        # [GCC 4.6.3] on linux2                                                   #           #
#        # Type "help", "copyright", "credits" or "license" for more information.  #           #
#        # >>> import curser                                                       #           #
#        # >>> # instanciate the Curser class like this                            #           #
#        # >>> turtle=curser.Curser(800/2,600/2)                                   #           #
#        # >>> # the object turtle will contains all the methods from the module   #           #
#        ###########################################################################           #
#                                                                                              #
#        import the Curser class with the from import directive:                               #
#                                                                                              #
#        ###########################################################################           #
#        # Python 2.7.3 (default, Apr 20 2012, 22:39:59)                           #           #
#        # [GCC 4.6.3] on linux2                                                   #           #
#        # Type "help", "copyright", "credits" or "license" for more information.  #           #
#        # >>> from curser import Curser                                           #           #
#        # >>> turtle=Curser(800/2,600/2)                                          #           #
#        # >>> # the object turtle will contains all the methods from the module   #           #
#        ###########################################################################           #
#                                                                                              #
################################################################################################

Documentation:

You can access to the documentation of the project online or download the documentation:

Online documentation:

ReadTheDoc online documentation:


Download documentation:


README:


Usage examples:



Files and useful links:

Folowing files and usefull links of the curser project are available:

Credits

Author: Eddie Br├╝ggemann.
Contact: mrcyberfighter@gmail.com
License: GPLv3.
Thank's to my beloved mother, my family and to the doctors.
Stay away from drugs: drugs destroy your brain and your life.