Roundrect Class Module#
roundrectClass module#
provides common methods to generate widgets
Base_Rect single border, plain fill Bi_Base_Rect double border, plain fill Gr_Base_Rect single border, gradient fill Gr_Bi_Base_Rect double border, gradient fill
All methods can make an open side as used in notebook tab
- class roundrectClass.Base_Rect(fout, w, h, exp, radius, first, second, tab=0)#
Bases:
objectbase class for rounded rectangles, single border, no gradient
- 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
- base(we, he, exp, re, first, second, tab)#
Draws base rectangle with rounded corners
- Parameters:
we (int) -- enlarged width, height
he (int) -- enlarged width, height
exp (int) -- enlargement factor
re (int) -- enlarged corner radius or gap in border
first (tuple of integers) -- outer border
second (tuple of integers) -- internal fill
tab (int) -- 0 normal widget - default, 1 open ended tab
- Return type:
PIL Image handle
- bi_round_corner(rad, exp, ofill, mfill, ifill)#
Draw a round corner, double border
- Parameters:
rad (int) -- corner radius or gap in border
exp (int) -- enlargement factor
ofill (tuple of integers) -- outer border
mfill (tuple of integers) -- inner border
ifill (tuple of integers) -- internal fill
- Returns:
corner -- handle PIL Image
- Return type:
str
- 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
- icol(startc, endc, steps, re, exp)#
Find the intermediate colours on the gradient
- Parameters:
startc (tuple of integers) -- Colours in rgb
endc (tuple of integers) -- Colours in rgb
steps (int) -- number colour steps
exp (int) -- enlargement factor
re (int) -- enlarged corner radius or gap in border
- Returns:
startci, endci -- Colours in rgb
- Return type:
tuple of integers
- round_corner(rad, exp, ofill, ifill)#
Draw a round corner, single border
- Parameters:
rad (int) -- corner radius or gap in border
exp (int) -- enlargement factor
ofill (tuple of integers) -- outer border
ifill (tuple of integers) -- internal fill
- Returns:
corner -- handle PIL Image
- Return type:
str
- trans(img, fout, w, h, radius)#
Resizes image to final size and makes transparent corners
- Parameters:
img (str) -- PIL image handle
fout (str) -- output png file
w (int) -- width, height output file
h (int) -- width, height output file
radius (int) -- corner radius or gap in border
- class roundrectClass.Bi_Base_Rect(fout, w, h, exp, radius, first, second, third, tab=0)#
Bases:
Base_Rect- bi_base(we, he, exp, re, first, second, third, tab)#
Draws base rectangle with rounded corners
- Parameters:
we (int) -- enlarged width, height
he (int) -- enlarged width, height
exp (int) -- enlargement factor
re (int) -- enlarged corner radius or gap in border
first (tuple of integers) -- outer border
second (tuple of integers) -- inner border
third (tuple of integers) -- internal fill
tab (int) -- 0 normal widget - default, 1 open ended tab
- Return type:
PIL Image handle
- class roundrectClass.Gr_Base_Rect(fout, w, h, exp, radius, first, second, startc, stopc, tab=0)#
Bases:
Base_Rect- gr_base(we, he, exp, re, first, second, startc, stopc, tab)#
Draws gradient filled rectangle with rounded corners
- Parameters:
we (int) -- enlarged width, height
he (int) -- enlarged width, height
exp (int) -- enlargement factor
re (int) -- enlarged corner radius or gap in border
first (tuple of integers) -- outer border
second (tuple of integers) -- internal fill
startc (tuple of integers) -- gradient start colour - must be RGB
stopc (tuple of integers) -- gradient finish colour - must be RGB
tab (int) -- 0 normal widget - default, 1 open ended tab
- Return type:
PIL Image handle
- class roundrectClass.Gr_Bi_Base_Rect(fout, w, h, exp, radius, first, second, third, startc, stopc, tab=0)#
Bases:
Gr_Base_Rect- gr_bi_base(we, he, exp, re, first, second, third, startc, stopc, tab)#
Draws gradient filled rectangle, double border with rounded corners
- Parameters:
we (int) -- enlarged width, height
he (int) -- enlarged width, height
exp (int) -- enlargement factor
re (int) -- enlarged corner radius or gap in border
first (tuple of integers) -- outer border
second (tuple of integers) -- inner border
third (tuple of integers) -- internal fill
startc (tuple of integers) -- gradient start colour - must be RGB
stopc (tuple of integers) -- gradient finish colour - must be RGB
tab (int) -- 0 normal widget - default, 1 open ended tab
- Return type:
PIL Image handle