Skip to content

Commit 4e5df07

Browse files
committed
Update README
1 parent 2630413 commit 4e5df07

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11

22
# ipycanvas
33

4-
Interactive widgets library exposing the browser's Canvas API
4+
Interactive widgets library exposing the [browser's Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) to Python. There are some API differences though:
5+
6+
- The `Canvas` widget is exposing the [`CanvasRenderingContext2D`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D) API
7+
- All the API is written in `snake_case` instead of `camelCase`, so for example `c.fillStyle = 'red'` becomes `c.fill_style = 'red'`
8+
- The `Canvas` widget exposes a `clear` method, we highly recommand using `c.clear()` instead of `c.clear_rect(0, 0, c.size[0], c.size[1])` for clearing the canvas, it will be much more efficient
9+
- We provide a `hold_canvas` context manager if you want to perform lots of commands at once
10+
11+
## Example
12+
13+
![Heatmap with NumPy](heatmap.png)
514

615
## Installation
716

heatmap.png

48.6 KB
Loading

0 commit comments

Comments
 (0)