summon.shapes
index
/home/raz/projects/summon/lib/summon/shapes.py

SUMMON - common shapes
 
This module provideds functions for building common shapes.

 
Modules
       
atexit
summon.core
math
os
summon_core
sys
threading
time
summon.util
summon.vector

 
Classes
       
summon.core.custom_group(summon.core.Element)
draggable
message_bubble

 
class draggable(summon.core.custom_group)
    draggable drawing element
 
 
Method resolution order:
draggable
summon.core.custom_group
summon.core.Element

Methods defined here:
__init__(self, region, element, callback=None)
region   -- a summon.Region object that specifies the region that 
            should respond to drag events
element  -- a group of drawing elements that should move during 
            drag events
callback -- a function that will be called for each drag event.
            The function will be called with the arguments
            (event, x, y).  These are the same arguments for the 
            callback for hotspot("drag", ...)

Methods inherited from summon.core.Element:
__cmp__(self, other)
__del__(self)
__eq__(self, other)
__getitem__(self, i)
Gets the i'th child of an element
__hash__(self)
__iter__(self)
Iterates through this element's child elements
__ne__(self, other)
append(self, element)
Append a drawing element to the children of this element
get(self)
Returns the content of an element as a tuple in a format specific 
to the particular element type
get_bounding(self)
Gets the bounding box of an element and all of its children
get_children(self)
Returns the children of this element as a list
get_parent(self)
Returns the parent of this element or None if no parent exists
get_visible(self)
remove(self, *elements)
Remove drawing elements from the children of this element
remove_self(self)
Remove the element from its own parent
replace(self, oldchild, newchild)
Replace a child element 'oldchild' with a new child 'newchild'
replace_self(self, newelm)
Replace the element with a new element
set(self, *args)
Sets the contents of the element
The argument format is specific to the particular element type
set_visible(self, vis)
Set the visibility of an element

 
class message_bubble(summon.core.custom_group)
    A message bubble that is invariant to zooming
 
 
Method resolution order:
message_bubble
summon.core.custom_group
summon.core.Element

Methods defined here:
__init__(self, x, y, width, height, contents=None, tail=(10, 30), tail_width=20, tail_attach=0.29999999999999999, radius=10, bubble_color=(17, 1, 1, 1, 1.0), border_color=(17, 0, 0, 0, 1.0), close_button=False, close_color=(17, 0, 0, 0, 1.0))
x            -- x-coordinate of target
y            -- y-coordinate of target
width        -- width of bubble
height       -- height of bubble
contents     -- content of bubble (drawing elements)
tail         -- tail direction (x, y)
tail_width   -- width of tail when it attaches to bubble
tail_attach  -- percentage of bubble to the left of the tail
radius       -- radius of bubble's rounded corners
bubble_color -- color of message bubble
close(self)
Closes the message bubble

Methods inherited from summon.core.Element:
__cmp__(self, other)
__del__(self)
__eq__(self, other)
__getitem__(self, i)
Gets the i'th child of an element
__hash__(self)
__iter__(self)
Iterates through this element's child elements
__ne__(self, other)
append(self, element)
Append a drawing element to the children of this element
get(self)
Returns the content of an element as a tuple in a format specific 
to the particular element type
get_bounding(self)
Gets the bounding box of an element and all of its children
get_children(self)
Returns the children of this element as a list
get_parent(self)
Returns the parent of this element or None if no parent exists
get_visible(self)
remove(self, *elements)
Remove drawing elements from the children of this element
remove_self(self)
Remove the element from its own parent
replace(self, oldchild, newchild)
Replace a child element 'oldchild' with a new child 'newchild'
replace_self(self, newelm)
Replace the element with a new element
set(self, *args)
Sets the contents of the element
The argument format is specific to the particular element type
set_visible(self, vis)
Set the visibility of an element

 
Functions
       
arc_path(x, y, angle1, angle2, radius, ndivs=10)
Returns the points for a round corner
 
x      -- x-coordinate of arc center
y      -- y-coordinate of arc center
angle1 -- starting angle of arc
angle2 -- ending angle of arc
radius -- radius of arc
ndivs  -- number of divisions for arc
arrow(headx, heady, tailx, taily, *tail, **options)
Draws an arrow
 
headx -- x-coordinate of the arrow head
heady -- y-coordinate of the arrow head
tailx -- x-coordinate of the arrow tail
taily -- y-coordinate of the arrow tail
*tail -- additional tail points
style     -- arrow style. choose from: 'solid' 
             (only one implemented currently)
head_size -- size of arrow head (default: 10)
offset    -- place arrow head an a different location (x, y)
             (default: (headx, heady))
arrow_head(headx, heady, tailx, taily, size=10)
Draws a triangular arrow head
 
headx -- x-coordinate of the arrow head
heady -- y-coordinate of the arrow head
tailx -- x-coordinate of the arrow tail
taily -- y-coordinate of the arrow tail    
size  -- size of arrow head
bezier(x0, x1, x2, x3, t)
bezier_curve(control_pts, ndivs=20)
box(x1, y1, x2, y2, fill=True)
Draws a rectangle (aligned with the x and y axis)
 
x1, y1 -- one corner of rectangle
x2, y2 -- the opposite corner of the rectangle
fill   -- a bool indicating whether the rectangle is filled or stroked
get_time = time(...)
time() -> floating point number
 
Return the current time in seconds since the Epoch.
Fractions of a second may be present if the system clock provides them.
lerp(x0, x1, t)
regular_polygon(x, y, nsides, radius, fill=True, rotate=0.0)
Draws a regular 'nsides'-sided polygon with size 'radius'
 
x, y   -- a point that defines the center of the polygon
fill   -- a bool indicating whether polygon is filled or stroked
rotate -- the number of degrees to rotate the polygon counter-clockwise
round_box(x1, y1, x2, y2, radius, ndivs=10, fill=True)
Draws a round rectanged (aligned with the x and y axis)
 
x1, y1 -- one corner of rectangle
x2, y2 -- the opposite corner of the rectangle
radius -- the radius of the rounded corner
          if radius is a list of 4 floats, it will be used to specify
          a radius for each corner (NW, NE, SE, SW)
ndivs  -- number of divisions for each corner
fill   -- a bool indicating whether the rectangle is filled or stroked