Prologue
Starting with version 0.7 there are going to be official releases on GitHub. 🎉
This is a major update for PyGVisuals that makes it a lot more easier to use. It also allows for a API-reference-page to be created automatically, meaning PyGVisuals now has a 🌟 homepage 🌟 !
This update does break old code written with this library. That being said, updating to the new version should not be that hard and should be preferred as documentation quality is on a new level now. To ease the updating process, I will highlight changes that will affect every old program and highlight changes that may affect some programs.
Also PyGVisuals should be easier to install now as I have fixed the setup.py. Simply run pip install git+https://github.com/Impelon/PyGVisuals.git
.
Changes
important changes
- now support both python 2 and python 3 (meaning the python-3-branch is counterintuitively designed to support python 2 as well)
- switch documentation-style to Google's python style allowing for an API-reference-site
- widgets support properties now for (almost) all aspects that were previously only accessible via getters and setters
- for example instead of
widget.setBackground((0, 0, 128))
one can now writewidget.background = (0, 0, 128)
- generally these getters and setters with the respective properties have been changed slightly, as some of them might accept new arguments and types
- there are also more properties to allow for more easily customizable widgets
- for example instead of
- restructure module: removed src-folder, module hierarchy is a lot more flat now. Here is how the imports change:
- pygvisuals.src.widgets ➡️ pygvisuals.widgets
- pygvisuals.src.widgets.border ➡️ pygvisuals.borders
- pygvisuals.src.io ➡️ pygvisuals.io
- pygvisuals.src.designs ➡️ pygvisuals.designs
- pygvisuals.examples are now moved outside the package to an 'examples'-folder
- merge IconWidget and Imagebox into Widget
getIcon
/setIcon
➡️getBackgroundImage
/setBackgroundImage
orbackground_image
-attributeisSmooth
/setSmooth
➡️hasSmoothScaling
/setSmoothScaling
orsmooth_scaling
-attribute- function to use for scaling can be accessed via the
scaling_function
-attribute - remove IconWidget
- remove Imagebox
- revamp design-system completely
- create a new default-design
- this new design includes a border, so all widgets will have a border by default
- to prevent this, import
pygvisuals.designs
and change the default-design to the classic-design (old default design) via:pygvisuals.designs.setDefaultDesign(pygvisuals.designs.getRegisteredDesign("classic"))
- designs are now stored inside a Design-class, instead of dicts
- designs are applied to widgets by the Design-class directly via:
design.applyToWidgets(list_of_widgets)
- designs are applied to widgets by the Design-class directly via:
- widgets no longer have hardcoded default values that need to be changed, instead they register a default in the fallback-design when loaded
- that being said, the Design-class can be created from dicts, look at the hardcoded-designs
- there is now a fallback-design, which is created automatically when importing widgets
- one can access it via
pygvisuals.designs.getFallbackDesign()
- one can access it via
- the default-design; it will be used for every newly created widget
- change it via
pygvisuals.designs.setDefaultDesign()
- change it via
- there is now a design-register; registered designs will have the fallback-design as fallback
- register designs via
pygvisuals.designs.registerDesign(name, design)
- get a registered design via
getRegisteredDesign(name)
- get a copy of the design-register as a dict via
getDesignRegister()
with the names being the keys and the values the designs
- register designs via
- for example to apply the "hologram"-design to all widgets in a list (or sprite-group, etc.):
pygvisuals.designs.getRegisteredDesign("hologram").applyToWidgets(list_of_widgets)
- create a new default-design
new features
Add a new example-script: design-chooser
It reads all defined designs and serves some demo-widgets to show the designs of.
Also one can change the background-color from black to white to test the design in different environments.
bug-fixes
Since there are no bugs that have been reported, not much, really. Some unexpected behaviour when deleting from an editable Listbox has been made more consistent.
other changes
- add util-module
- add automatic docstring-inheritance
- add util.constants; a collection of every constant defined in PyGVisuals
- rework a lot of mechanisms
- some widgets constructors have changed slightly
- slightly rework the basic update-method for widgets
- rework borders to have a draworder
- generally less redundancy, more compact code
- add more documentation to examples
- improve README