yt-project / widgyts

Widgets for yt
https://widgyts.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
10 stars 10 forks source link

Add an ImageCanvas widget #3

Closed matthewturk closed 6 years ago

matthewturk commented 6 years ago

This sets up an image canvas widget that, from Python, pushes over to the context and displays a 4 channel image.

import numpy as np
import yt_pycanvas
image_array = (np.random.random((100, 100, 4)) * 255).astype("uint8")
image_array[...,3] = 255
hw = yt_pycanvas.ImageCanvas(image_array = image_array, width=256, height=256)
display(hw)