A 2D graphics API that mimics the Processing API
Project description
PyVis
PyVis is a 2D graphics API that mimics the Processing API.
Installation
-
Download the repository as a .zip file.
OR use pip to install it from PyPI (and skip all other installation steps, unless you want to try out the example):pip install piefish
-
Copy and paste all .py files into your project folder.
-
Make sure you've got all of the required pip packages installed:
- pygame
- colorama
How to use
Main script setup
First of all, you need to import the pyvis.py
file:
import pyvis
Note: since all functions for drawing are part of the pyvis namespace, you might
want to use import pyvis as pv
instead.
After that, you can initialize PyVis by calling the 'init()' method:
pyvis.init()
The nice thing about PyVis is that the update loop is already setup for you. The only thing you need to do is add your functions to the update loop by adding them to a function pool.
Function pools are lists of functions that get called at a certain point in the kernel loop. For example, the "draw"-pool gets called every frame, whilst the "setup"-pool only gets called at the start of the program.
You can add functions to a function pool as follows:
@pyvis.kernel.pool("draw", 1)
def yourFunction():
# Do something
The number after the name of the draw pool indicates the priority of that function in the pool. Functions with a higher priority will be executed before others.
To start the kernel loop, add this line at the end of your main script:
pyvis.kernel.run()
Your final script should look like this:
import pyvis as pv
pv.init()
@pv.kernel.pool("setup",1)
def onSetup():
# do something
@pv.kernel.pool("draw",1)
def onDraw():
# do something
pv.kernel.run()
All functionality is included in the example, and you can use it as a reference to create your own application.
PyVis 0.1.8a
Change log
- PyVis is now a PyPI package!
- Renamed package to piefish to remove name conflicts (I had to come up with something..)
- Some other minor stuff
Hotfixes
- 0.1.8a1
- updated this file
PyVis 0.1.5a
Change log
- Further improvements in kernel loop.
- Added splash screen.
- Expanded functionality in fps monitoring.
- Improved and added log messages.
- Command line colors! :D
PyVis 0.1.3a
Change log
- Improved kernel loop performance.
- Fullscreen now works properly.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for piefish-0.1.8a3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ffccb049e76f07e9198cc646c43bdb209a18c2ebe48940925cf89aeee58b89a |
|
MD5 | 7b10f3d50f8b1e1968423b263aa35ac4 |
|
BLAKE2b-256 | f90ffc033b88fbcc98c654ae3965b9e57fece06a4e8c56b08bae75e4393841c6 |