Skip to content
Luke edited this page Apr 16, 2020 · 16 revisions

Canvas Plus

forthebadge made-with-python PyPI version shields.io GitHub release GitHub license PyPI pyversions

Welcome to the CanvasPlus wiki!

Here you will find the documentation for the latest version of CanvasPlus

Installation

To start, make sure you have CanvasPlus installed or cloned. You can do this with one of two methods.

Option 1: Pip

Pip install this package

pip install CanvasPlus

Option 2: Github

Download a zip file containing all files.

git clone https://github.com/Luke-zhang-04/CanvasPlus.git

or
Clone the latest stable Release Screen Shot 2020-04-15 at 11 26 54 PM

Importing

There are a few ways to import the module. It is advised that you do not import the entire module.

If an __init__.py file exists with the source code in a seperate directory (recommended)

from CanvasPlus import CanvasPlus
CanvasPlus()
import CanvasPlus
CanvasPlus.CanvasPlus()

If the source code is in the same directory as your project

from CanvasPlus.canvasplus import CanvasPlus
CanvasPlus()
import CanvasPlus.canvasplus as CanvasPlus
CanvasPlus.CanvasPlus()

If there is no __init__.py file and the source code is in a different directory as your project (why would you do this?)

from canvasplus import CanvasPlus
CanvasPlus()
import canvasplus
canvasplus.CanvasPlus()

Setup

After, you can set up with what you normally would, with one change; instead of the Canvas class, use the imported CanvasPlus class

from canvasplus import CanvasPlus #or another import method of your choice (described above)
from tkinter import Tk

root = Tk()
canvas = CanvasPlus(
    root, width = 800, height = 800, background = "white"
)
canvas.pack()
canvas.update()
Clone this wiki locally