This package provides a supercanvas widget based on the original
tkinter canvas. It provides a fast useable canvas for function
drawing.
class object
>>> from supercanvas import *
Once package importation completed, you have to create a supercanvas the usual way.
r = tkinter.Tk()
c = supercanvas(r, bg="white", width=800, height=600)
origin and units
By default, origin is located at supercanvas's center and units
are both 1 pixel (and axes are drawn in french style with
arrows). You can change this with setOrigin and setUnit
methods:
c.setUnit(80, 100)
c.setOrigin(50, 200)
supercanvas items
supercanvas provides, for the moment, two items to draw Point
and Line:
drawPointmethod create a point at the desired coords.
f = lambda x:x**2
x = 3
c.drawPoint(x, f(x), fill="red", outline="red")
It's based on create_oval so you can pass each option related to
Oval object.
drawLinemethod create a line with a list of coords.
c.drawLine([(-2, 2), (-1, 0), (0, 3)], fill="blue", width=3)
drawLine also supports a flat list of coords:
c.drawLine([-2, 2, -1, 0, 0, 3], fill="blue", width=3)
gives the same line.
cursor
The cursor gives you actual coords of its position. In the future, you will be able to toggle this feature.
You can move the whole supercanvas content in grabing /
realeasing the background. It will refresh coords.
full example
from supercanvas import *
import math
r = tkinter.Tk()
c = supercanvas(r, bg="white", width=800, height=600)
c.setUnit(100, 100)
f=lambda x:math.cos(x)
g=lambda x:math.sin(x)
p = .1
a, b = -3, 3
x = a
listePointsF = []
listePointsG = []
for i in range(int(1 + (b - a) / p)):
# creating points
c.drawPoint(x, f(x), fill="red", outline="red")
# two lists
# function f with tuples
listePointsF += (x, f(x))
# function g with flat list
listePointsG += [x]+[g(x)]
x += p
# drawings of the two curves
c.drawLine(listePointsF, fill="green")
c.drawLine(listePointsG, fill="blue", width=3)
# balancing canvas on the root
c.pack(expand=True)
# q to quit
r.bind("<q>", quit)
tkinter.mainloop()
further
Much much more!
about
supercanvas is rather an attempt to publish on the PyPi packages
index than a fully completed python project, I do not recommend
supercanvas usage for professionnal use. You have to consider this
package as an experiment.
Metadata
Release files for supercanvas 0.1.0
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 | |
|---|---|---|---|---|
| supercanvas-0.1.0.tar.gz | 4.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| supercanvas-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / supercanvas-0.1.0.tar.gz
| Download URL | supercanvas-0.1.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6620a44881bbee0bc96204b6cb50c7ae8692bbfdb403c89f0acafba34030152f
|
|
BLAKE2b-256 checksum How to use checksums |
842707f195f3ba9cfb15aa58f2a9eac582d2abe36b42f1e2f13ce8c5d9a61566
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2rc1
|
Release files / supercanvas-0.1.0-py3-none-any.whl
| Download URL | supercanvas-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42afe2898592220a97e44e37010286b8269e41683ba92d354856a96e7fd5a495
|
|
BLAKE2b-256 checksum How to use checksums |
659e2f79358b3e45f59f6540a6d4fc682635351bfd18b114841e589bafa8ac11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2rc1
|
Security for supercanvas 0.1.0
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.