Git Product home page Git Product logo

ipycanvas_drawing's Introduction

Jupyter drawing utility

Binder

Small utility to make simple drawings in Jupyter notebooks with ipycanvas and ipywidgets. Useful for getting quick user input in research prototypes, e.g., for masking or annotation.

Example usage

Install

pip install ipycanvas-drawing

Usage

Create a simple drawing interface. Check out the notebook in examples for a more complete example.

from ipycanvas_drawing import DrawingWidget

# Create a drawing widget
# You can set other setup parameters: background, alpha, default_style, default_radius
drawing_widget = DrawingWidget(width=500, height=500) 
# Show the drawing widget
drawing_widget.show()

# Get the image data as a numpy array
image_output = drawing_widget.get_image_data()

Known issues

  • Visual Studio Code's Jupyter environment doesn't like ipycanvas's sync_image_data functionality. Workaround: open notebooks in Jupyter lab or Notebook in the browser.
  • ipycanvas does not work in Google Colab. Workaround: use the Binder to quickly try the tool without needing to install it on your own machine.

Credits

Based on the hand drawing example provided by @martinRenou, but adds some additional functionality like adding squares and ellipses and a 1-step undo.

ipycanvas_drawing's People

Contributors

rubenwiersma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.