Package Things :: Module BoxOfTricks
[frames] | no frames]

Module BoxOfTricks

General drawing tools

In this module you will find a collection of tools for drawing.

Classes
  TextBlock
This will get you a quick block of text.
  RoundRect
Use this to draw rectangles with rounded corners.
  DrawLang
Use this to generate stepped-paths with curved corners.
  fuzzydot
Ye olde generic fuzzy dot.
Functions
 
zerodot(ctx)
A big red circle for quick debugging.
 
zerorect(ctx, w, h, nostroke=False)
A function to draw a red rectangle at zero, of given width/height.
 
hexfloat(s)
Given an HTML-style hex colour, return the cairo r,g,b colour numbers for it.
 
circrandom(radius)
Returns a random point (tuple) on a circle of given radius.
Variables
  pi2 = 6.28318530718
  hp = 1.57079632679
  pi90 = 4.71238898038
  pi3 = 9.42477796077
  __package__ = 'Things'
Function Details

zerodot(ctx)

 

A big red circle for quick debugging. This is a function, so just call it with a context.

zerorect(ctx, w, h, nostroke=False)

 

A function to draw a red rectangle at zero, of given width/height. nostroke False will stroke it. For debugging.

hexfloat(s)

 

Given an HTML-style hex colour, return the cairo r,g,b colour numbers for it. If given an alpha value, this returns r,g,b,a

You can use this in places like ctx.set_source_rgb( *hexfloat("#FF00BB") ) -- the * expands the return value into a list for the function it's passed-to.