Sort_visualizer
Sort_visualizer is a tool that will allow you to easily visualize any sorting algorithms
Install
pip install sort-visualizer
Usage
Short guide
- Install package
- Create
.pyand import package withfrom sort_visualizer import gui, algs - Create your own sort (Or use ones you need from algs.py)
- Initialize gui object with
gui.GUI() - Add sorting algorithms to gui via
test_gui.add_sort(NAME, SORT_CLASS)
To add from
algs.pysimply usetest_gui.add_sort('Bubble', algs.BubbleSort), for example
- Run gui with
test_gui.run()
How to write your own sort
In order to visualize your own sort you need to create a class that inherits from algs.Sort and implement execute(self) method.
To access array use self.array.
Every object in self.array is a Rectangle class instance. To access associated value use .height attribute.
Visual functions:
- When an element changed its value use self.redraw()
- When swapping two elements of the array use self.swap_rects(rect1: Rectangle, rect2: Rectangle)
(Please note that swap_rects function only applies visual part, you still need to actually swap the values in array)
In test.py you can find example of creating your own algorithm and actually run python test.py` to see how it works.
To see more examples check sort_visualizer/algs.py
Metadata
Release files for sort-visualizer 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sort_visualizer-1.0.6.tar.gz | 6.4 kB | Without provenance | Details |
Release files / sort_visualizer-1.0.6.tar.gz
| Download URL | sort_visualizer-1.0.6.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
257ee2131b0a786dee1ad13d51ec7ca0778f656c042604732a076f1c0ca8ea56
|
|
BLAKE2b-256 checksum How to use checksums |
c76bbd6c126b7d5210847ede753f57b1b225f5ca68d69a326645fe9831cdf7b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.6
|
Security for sort-visualizer 1.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.