Releases: BhavyeMathur/goopylib
2.1.0
What's Changed
This change marks finally merging the previously 2 distinct goopylib repositories into one. All the history of goopylib v1 has been stacked with v2.
Major changes
- Migrated the C++ Extension to Pybind11 by @BhavyeMathur in #3
- Renamed Renderable
ZPosition
methods toz
CameraFrame
&CameraFrameSize
are now classes in the Python API
New Features
Minor changes
- Renderable
draw()
method now returns a reference to the Renderable - Added virtual destructor for Renderable
- Marked Renderable
getTransparency()
methods asconst
Fixes
1.1.318a25
-
Fixed bug with the
Rectangle
class'scopy()
function not creating a copy of the position lists and just creating a
new reference -
Fixed bug with the
Colour
class's__eq__()
and__nq__()
functions raising anAttributeError
when comparing
against a non-Colour
object -
Fixed the
hex_to_rgb()
and_hex_to_rgb()
functions to return a tuple, not generator -
Fixed bug with the
hex_to_hsl()
andhex_to_hsv()
functions both returning CMYK values -
Created new colour converter testing functions
-
Changed
Window
__repr__()
function to use"Window"
and not"GraphWin"
-
Renamed the
Window
is_resizable()
,is_width_resizable()
, andis_height_resizable()
to useget
instead -
The
Window
get_resizable()
function now returns atuple
not alist
-
Removed the
Window
__str__()
function since__repr__()
defined the same thing -
Added
Window
getter function testing functions -
Fixed bugs with all the CMYK colour conversion functions
-
Changed the
GraphicsError
in theWindow
's__check_open()
function to include the string"GraphicsError"
at the
start and returnTrue
if the window is open -
Added
_check__check_open()
and_check__autoflush()
methods to theWindow
class to check the functionality of
private methods -
Removed the
Window
start_move()
andstop_move()
methods until I can figure out what they do -
Removed the
Window
draw_bounds()
function because it wasn't required. -
Fixed the
Window
get_pos()
,get_x_pos()
, andget_y_pos()
functions to return the value relative to 0, 0 -
Replaced all instances of the deprecated
Point
class usages with lists inWindow.py
-
The
Window
set_background()
method no longer uses styles -
Changed
Window
get_bk_colour()
method toget_background()
to be consistent with the setter -
Window
background colours can not be inputted as hex strings -
Removed all auto-flush checks in the
Window
methods because its private method__autoflush()
also does that -
Renamed the variable
RELIEF
toBORDER_RELIEFS
-
The
Window
set_icon()
method now accepts icons in the local folder too -
Added 3 getter methods to the
Window
class:get_draggable()
,get_x_draggable_x()
,get_y_draggable()
-
Added 5 getter methods to the
Window
class:get_top_right()
,get_top_left()
,get_bottom_right()
,
get_bottom_left()
, andget_center()
-
Fixed bug with the
GraphicsObject
get animation time left functions raising aTypeError
-
Fixed error with the
Text
clone()
method trying to clone aNone
type bounds object -
Added 5 getter methods to the
_BBox
classes:get_top_right()
,get_top_left()
,get_bottom_right()
,
get_bottom_left()
,get_left()
,get_right()
,get_bottom()
,get_top()
-
Fixed the colour definition of
DARKISH_TURQUOISE
from a purple colour to a turquoise colour -
Internally changed how the button
Button
class keeps a track of its current state (normal, hover, or clicked) -
Redefined the
_update_lasttime
variable which was removed for an unknown reason -
Renamed the base colour conversion functions, like
_rgb_to_hex()
torgb_to_hex_nocheck()
-
Added a
__version__
variable that keeps track of the goopyplib version, and an__all__
variable -
Added American (spelled with color) colour conversion tests to
goopylib_tests.py
-
Renamed the goopylib
math
subpackage tomaths
to avoid conflicts with Python's standard library -
Removed
'x_cursor'
fromCURSORS
and moved it toCURSORS_WINDOWS
since it isn't available on MacOS
1.1.282a14
-
Fixed bug with the
Line
requiring a typelist
for dashes, nottuple
-
Fixed bug with the
Line
class ensuring that the integers for custom dashes are less than266
, not256
-
The
Line
,Polygon
, andRectangle
class now create a copy of all the points entered -
triangulation.py
no longer uses the deprecated Point class -
Fixed bug with the
__update_lasttime
variable not being defined inutil.py
1.1.277a13
-
Added C implementations of conversion functions to convert between colour formats
-
The default values for colour arguments in the Python Colour classes is now 0 to mimic the behaviour of the C classes
-
Removed print statement from the Window class mistakenly left there for debugging
-
Removed creation of the
a0
variable insideCubicInterpolation()
since it wasn't needed -
Renamed all the functions inside
interpolations.py
to follow the Python naming convention -
Renamed all the functions inside
curves.py
to follow the Python naming convention -
All the functions inside
curves.py
no longer use thePoint
class for creating their curves -
Removed debugging print statement from
GraphicsObject.py
-
Fixed error with the
linear_curve()
andcosine_curve()
functions not working properly -
All interpolation functions now accept points in the form
[x, y]
-
Added a
cubic_curve()
andhermite_curve()
function to interpolate between control points -
Fixed bug with the
CurvedLine
class not drawing its options -
Added an example file for the interpolation curve functions
-
Added DPI awareness scaling for the Windows OS
-
Added functions to enable and disable the DPI awareness:
enable_dpi_awareness()
anddisable_dpi_awareness()
-
Fixed the
colour_gradient()
function because it wasn't working when there were 3 divisions -
Changed the roundness of rounded rectangle to work better than before. The amount of roundness now refers to the
radius of the roundness -
Implemented the
__getitem__()
functions for the Colour classes to override indexing -
Added
set_fill()
,set_outline_width()
, andset_outline()
functions to the_BBox
class -
Added an
is_enabled()
andis_disabled()
function to theButton
andCycleButton
(andCheckbox
) classes -
The
CycleButton
(andCheckbox
) class now defaults to the current graphic if no disabled graphic is present -
The
Text
class now defaults the font colour to the default'font colour'
option, not to default'outline'
-
Fixed bug with the
Rectangle
clone()
function throwing an error when the object has no defined bounds -
Fixed bug with the
Polygon
class still using the deprecatedPoint
class -
Fixed bug with the
Polygon
__init__()
not using the fill, outline, and outline width arguments correctly -
Reimplemented the
Polygon
set_fill()
,set_outline()
, andset_outline_width()
functions properly -
Fixed bug with the
Line
class not working with layers -
Implemented the
get_fill()
,get_outline()
, andget_outline_width()
functions for thePolygon
class fixing
other bugs as a result -
Added rotation functions to the
Text
class -
All non-getter
Text
class functions now returnself
-
Fixed bug with the
GraphicsObject
class not checking if an object is draggable properly, led to performance upgrade
on mouse presses
1.1.246a22
-
Implemented all remaining PyNumberMethod methods for the C
Colour
class -
Changed the
Colour
class's__round__()
method to round up to 255 when the colour value is greater than 127,
compared to the previous 128 -
Updated the link to the goopylib Colour doc in the
Colour
class's__dir__()
function -
Defined the
__dir__()
,__round__()
,__reversed__()
, &__contains__()
functions for the CColour
class -
Added a separate
__contains__()
method for theColourHex()
class -
Fixed the
Colour_richcompare()
method of the CColour
class for the==
&!=
operations -
Renamed the
update_values()
method of theColour
classes to__update_values()
-
Fixed circular import with importing the
Window
while important theGraphicsObject
module without importing the
Window
module yourself -
Fixed issue with incorrectly named module import in
goopylib.sound.waves.py
-
Fixed error with the
Window
class incorrectly initializing because the root wasn't updating, see
https://stackoverflow.com/questions/34373533/winfo-width-returns-1-even-after-using-pack
1.1.236a21
-
Fixed warning with the
string
attribute of the C implementation of theColourHex
class in which thePyObject*
was being defined to achar[7]
. It is now defined to aPyUnicode
object. -
Changed
abs()
tofabs()
incolours.c
when it took afloat
argument -
The
hexstring
variable in thergb_to_hex()
function incolours.c
is now static to avoid returning a 'address of
stack memory associated with local variable' -
Renamed all the modules in goopylib.math & all C extensions with the Python naming convention
(lowercase & underscores) -
Fixed bug with the goopylib C extension modules raising errors when being imported
-
Removed the
__get_item__()
&__len__()
functions of theColour
class as they didn't make a lot of sense to keep -
Simplified expressions to check for valid arguments in
colours.py
and made them run faster by removing unneeded
not
s -
Renamed
Sound.py
tosound.py
to follow the Python naming convention -
Added argument validation to all functions in
colours.py
to ensure the user has entered the correct types -
Fixed bug with the
Colour
class incorrectly executing the__contains__()
function -
Every
Colour
subclass has separate__contains__()
,__round__()__
,__iter__()
, &__copy__()
methods -
Changed
max([...])
tomax(...)
inside thecolour_gradient()
&color_gradient()
functions to make them faster -
Added another set of colour conversions with a
_
prefix, these functions do not validate arguments -
The Colour types in
colours.c
now use aPyObject *
to store the hex colour string of a colour instance as opposed
to the previous use of achar[7]
-
Fixed error with the C colours module not compiling when
PyNumberMethods
of the Colour type were specified in the
module INIT -
The C
ColourHSV
&ColourHSL
types now take integer arguments for the S & V, and S & L values just like the Python
classes -
Fixed the conversion from HSV to RGB and HSL to RGB in the initialization functions of
ColourHSV
&ColoursHSL
in
colours.c
-
Moved the error checking from the
bezier_curve.py
interface toc_bezier_curve.c
making it faster -
The
factorial()
function defined inc_bezier_curve.c
is no longer accessible from Python
(use standardmath.factorial()
instead) -
Defined all unary PyNumberMethods for the C implementation of the
Colour
class as well as nb_add, nb_subtract,
nb_multiply, nb_remainder, nb_divmod, & nb_power. All other PyNumberMethods return an emptyColour
class
1.1.216a20
-
Fixed bug with the
ColourHSL
&ColourHSV
classes not correctly converting to RGB values properly when
120 <= h < 180
-
Added a C implementation of the
ColourHSV
&ColourHSL
classes tocolours.c
-
The Colour type in
colours.c
finally overrides the number protocol (for operations like addition, subtraction, etc.) -
Fixed mispelt argument name
color_start1
in thecolor_gradient_2d()
function -
Changed the
__init_subclass__()
method in theColour
class to just a__init__()
method as the previous wasn't
required -
Moved the default instance variable definitions in the
Colour
class outside the__init__()
function and to static
variables -
Allowed the C implementation of the
rgb_to_hex()
function to be accessible from Python -
Changed the docstrings of the
CBezierCurve
module functions to show what the output type of each function is -
Added a
hex_digit_to_int()
function tocolours.c
that allows you to convert a hexadecimal digit to a base-10 int -
The
Colour
types implemented in C are now actually semi-usable. -
Removed the
__format__()
method from theColour
class because it wasn't required -
Changed the C-implementation of the
Colour
type's__repr__()
method to match the Python implementation -
Fixed misordered format values in the
rgb()
method of theColour
class -
Reordered the PyNumber Methods of the
Colour
class to follow the order described here:
https://docs.python.org/3/c-api/typeobj.html?highlight=tp_#c.PyNumberMethods -
Changed the
__hex__()
method of theColour
class to return aColourHex
instance of the same colour as which the
function is used on -
Made the
Colour
class PyNumber Methods faster by replacing themin([255, ...])
for if statements -
Using the multiplication operator on a
Colour
instance will now make sure that the rgb values for the colour are less
than 256 -
You can no longer perform operations with floats and
Colour
objects -
The
pow()
function withColour
objects now accepts aColour
type value for the modulo argument -
Colour
object PyNumber Methods now set the red, green, or blue value to 0 if the resulting value from operation is
less than 0 -
Added functions to convert between colour types:
hex_to_rgb()
,cmyk_to_rgb()
,hsv_to_rgb()
,hsl_to_rgb()
,
rgb_to_cmyk()
,rgb_to_hsl()
,rgb_to_hsv()
,hex_to_cmyk()
,hex_to_hsl()
,hex_to_hsv()
,cmyk_to_hex()
,
cmyk_to_hsl()
,cmyk_to_hsv()
,hsv_to_hex()
,hsv_to_cmyk()
,hsv_to_hsl()
,hsl_to_hex()
,hsl_to_cmyk()
, &
hsl_to_hsl()
-
Copied the
Colour
class's__floordiv__()
function to its__truediv__()
one to use"/"
in the error message
rather than"//"s
-
The
ColourHSL
&ColourHSV
classes now only accept integer values representing percentages for H & L, and H & V to
make it consistent withColourCMYK
-
Simplified the conversion of inputs to RGB for the
ColourCMYK
,ColourHSV
, &ColourHSL
classes by removing 3
redundant variables -
Fixed bug with the
Colour
classes not updating their string & hex value when performed operations on. This meant
that operations on colours had no real effect. -
Renamed the colour
ABSOLUTE_TURQUOISE
toABSOLUTE_CYAN
-
colours.py
now uses theround()
function to round outputs of operations/functions on colours to the nearest
integer rather than the previousint()
which sometimes gave errors of +-1 -
Fixed a bug in the
ColourCMYK()
class where the CMYK colours were not being properly converted to RGB -
Renamed the
Colour
class'srgb()
function torgb_string()
-
Added methods to return a
Colour
instance's colours in different colour models:hex_string()
,cmyk_string()
,
hsv_string()
,hsl_string()
-
Added methods to the
Colour
class to convert the colour into another colour type:to_rgb_colour()
,
to_hex_colour()
,to_cmyk_colour()
,to_hsl_colour()
,to_hsv_colour()
-
There are now separate PyNumber methods for each
Colour
subclass (exceptColourRGB
) whose return values are the
type the operation is performed on -
All goopylib pre-defined colours use the
ColourRGB
class (some previously usedColourHex
) as it is the most
efficientColour
subclass -
Fixed the ordering of
ColourCMYK
arguments fromc, y, m, k
toc, m, y, k
-
Changed the
__lshift__()
&__rshift__()
methods of theColour
class to ensure that the returned value is within
permitted bounds for a colour -
Added setter functions for
Colour
subclasses to set individual colour arguments -
Operations on Colours of the same type (RGB & RGB, HSL & HSL, etc.) are now performed argument-wise for that colour,
ie h1 + h2, s1 + s2, v1 + v2 for HSL + HSL rather than converting to RGB first. -
The inplace PyNumber methods of the
Colour
subclasses (except forColourRGB
&ColourHex
) now follow the same
rules as the normal PyNumber methods
1.1.176a19
-
You can now use the
set_text()
function forEntry
objects even if theEntry
hasn't been drawn -
Fixed the
RandomColourRGB()
function to no longer raise errors if the user hasn't specified the RGB values -
Optimized the error checking in the
RandomColourRGB()
&RandomGreyscale()
functions by reducing the number of
not
&!=
-
Simplified the
RandomColourCMYK()
function and optimized it like with theRandomColourRGB()
one -
The
RandomColourHex()
function now works if the user hasn't supplied hex values for r, g, & b and optimized the
function to execute faster -
Added a new lists to contain all of
GREENS
,PURPLES
, etc. and forWARM COLOURS
andCOOL COLOURS
-
Added a list of all goopylib colours objects
-
Added HSV colours to goopylib: a
ColourHSV
class &RandomColourHSV()
function -
Changed all the
GraphicsError
s incolours.py
to be raised with a"GraphicsError:"
prefix -
The
ColourCMYK
class is now printed as"cmyk c%, m%, y%, k%"
rather than the previous"cmyk c, m, y, k"
-
The Internal goopylib classes no longer use the
Point
class in favour of an iterable -
Added a few more (7) colour definitions to complete the existing colour scales
-
Added HSL colours to goopylib: a
ColourHSL
class &RandomColourHSL()
function -
Renamed all the functions inside
colours.py
to follow the Python naming convention -
Added American spelling (
color
) equivalents of everything incolours.py
which references the original functions -
Renamed the
blend_BLENDINGTYPE()
functions toblend_colour_BLENDINGTYPE()
and added their American equivalents. -
Moved the
random
module's import statement above thegoopylib.math.Interpolations
import statement incolours.py
to abide by PEP8 -
Created a
color.py
file which simply imports everything fromcolours.py
1.1.158a18
-
The
is_clicked()
function of theGraphicsObject
class returns whether or not the object'sbounds
were clicked.
If it has no bounds, it returnsFalse
-
Made the
RadioButton
class an iterable -
You can now use the
len()
function onRadioButton
andCycleButton
objects -
The
RadioButton
andCycleButton
classes are now subscriptable -
Added an
anchor
attribute to theCycleButton
class to support gliding -
The
RadioButton
andCycleButton
classes now support movement and gliding functions -
The
get_anchor()
function of theCycleButton
class now returns the value from its states'get_anchor()
function,
not theanchor
attribute itself -
The
is_clicked()
function in theImage()
class now uses integer division (//
) rather than float division (/
)
to make it slightly faster and also pre-calculates the divisions to perform half the division operations -
Fixed bug with the
RadioButton
&CycleButton
class not changing their anchors when moving -
Fixed bug with all the
GraphicsObject
glide functions adding 2 lists together instead of their elements -
The
RadioButton
class now raises an error if the user has specified 0 states -
Added a
get_anchor()
function to theRadioButton
class -
Fixed bug with
Button
objects not defining theiranchor
during the initialization -
The
change_graphic()
function of theButton
class now allows you to set graphics toNone
-
The
GraphicObject
class now raises an error if the user tries to glide an object which does not support it -
Renamed the
allow_only_numeric()
function of theEntry
toallow_only_positive_integer()
and added 2 new
functions:allow_only_numeric()
andallow_only_integer()
1.1.142a17
-
Fixed bug with the default Image Texture path being
textures_other/
instead oftextures/
-
Fixed bug with every
GraphicsObject
entering an infinite loop when the user sets the objects' layer to not 0 -
Added
animate_resize()
andanimate_resize_factor()
functions to theGraphicsObject
class -
Added a
get_state()
function to theRadioButton
class -
You can now specify custom bounds for a
Checkbox
instance -
Fixed bug with the Text object's
is_clicked()
function not working properly when the text is not center-aligned -
Fixed bug with the
GraphicsObject
class raising an error when you try to destroy an object twice -
Added a
set_state()
function to theRadioButton
class