tools Class Module#

toolsClass module#

Toolbox of functions used while creating theme

toolsClass.LerpColour(c1, c2, t)#

Gives the colour found between 2 colours

Parameters:
  • c1 (tuple of integers) -- Colours in rgb

  • c2 (tuple of integers) -- Colours in rgb

  • t (decimal) -- Ratio of colour mix 0 <= t <= 1

Return type:

colour in rgb

toolsClass.create_circle(idraw, c, r, fill)#

create circle using centre and radius

Parameters:
  • idraw (str) -- PIL drawing handle

  • c (int) -- centre co-ordinates

  • r (int) -- radius

  • fill (str or tuple of int) -- fill colour name, hash or tuple

Return type:

Circle

toolsClass.create_pie(idraw, c, r, fill='#888888', start=180, end=270)#

create pieslice using centre and radius, outline not used

defaults to 90° in upper left quadrant :param idraw: PIL drawing handle :type idraw: str :param c: centre co-ordinates :type c: int :param r: radius :type r: int :param fill: fill colour name, hash or tuple :type fill: str or tuple of int :param start: start and end angles in degrees :type start: int :param end: start and end angles in degrees :type end: int

toolsClass.gr_2d_rect(we, he, exp, re, first, second, startc, stopc)#

Creates most widget single border, gradient fill

Need to reduce in size and add transparent pixels

Parameters:
  • we (int) -- width, height enlarged sizes

  • he (int) -- width, height enlarged sizes

  • exp (int) -- enlargment factor

  • re (int) -- enlarged radius

  • first (tuple of int) -- border rgb colour

  • second (tuple of int) -- fill rgb colour

  • startc (tuple of int) -- rgb gradient colour

  • stopc (tuple of int) -- rgb gradient colour

toolsClass.gr_base(we, he, exp, re, first, second, startc, stopc)#

Single border rounded rectangle with gradient

Parameters:
  • we (int) -- width, height of enlarged image

  • he (int) -- width, height of enlarged image

  • exp (int) -- enlargement factor

  • re (int) -- enlarged corner radius/ gap size

  • first (str or int) -- colours of corners

  • second (str or int) -- colours of corners

  • startc (tuple of int) -- start rgb colour

  • stopc (tuple of int) -- finish rgb colour

toolsClass.icol(startc, stopc, steps, re, exp)#

find the intermediate colours on the gradient

Parameters:
  • startc (tuple of int) -- start rgb colour

  • stopc (tuple of int) -- finish rgb colour

  • steps (int) -- number steps in gradient

  • re (int) -- enlarged radius

  • exp (int) -- enlargement factor

toolsClass.round_corner(rad, exp, ofill, ifill)#

Draw a round corner, single border

Parameters:
  • rad (int) -- corner radius

  • exp (int) -- enlargement factor, normally 9

  • ofill (str or int) -- outer fill

  • ifill (str or int) -- inner fill

toolsClass.trans(img, w, h, radius, cmax=759)#

create transparent pixels at 4 corners

Parameters:
  • img (str) -- PIL drawing handle

  • w (int) -- image size width height

  • h (int) -- image size width height

  • radius (int) -- corner radius/ gap size

  • cmax (int) -- near white colour sum

toolsClass.transx(img, w, h, cmax=759)#

find all near white pixels and change into transparent pixels

Parameters:
  • img (str) -- PIL drawing handle

  • w (int) -- image size width height

  • h (int) -- image size width height

  • cmax (int) -- near white colour sum