In [1]:
import IPython
from widget_canvas import CanvasImage
from widget_canvas import image

data_image = image.read('images/Whippet.jpg')



In [2]:
data_comp = image.encode(data_image, fmt='jpg')
# ip=IPython.get_ipython()

In [3]:
img = IPython.display.Image(data_comp)

In [4]:
img


Out[4]:

In [5]:
IPython.display.display(img)

print('ABC123')

print('hello!')


ABC123
hello!

In [ ]:


In [6]:
wid = CanvasImage(data_image, format='jpeg')

In [7]:
html_template = '<img src="{}" class="{}">'

src = wid._encoded_url.decode()
cls = 'my_image_' + wid._uuid

h = html_template.format(src, cls)
H = IPython.display.HTML(h)

In [10]:
# hey!
wid

In [7]:
def display_wrapper(wid):
    # template = '<img class="{}" style="display: none">'
    template = '<img class="{}">'
    c = 'static_image_' + wid._uuid
    html = template.format(c)

    IPython.display.display_html(html, raw=True)

    IPython.display.display(wid)

In [8]:
display_wrapper(wid)



In [ ]:


In [11]:
wid.something()

In [ ]:


In [13]:
template = '<img src="{}" class="{}">'  # style="display: none">'

c = 'static_image_sdsdsd'
s = wid._encoded_url.decode()
html = template.format(s, c)
IPython.display.display_html(html, raw=True)



In [11]:
print('AAAAA')
IPython.display.display(H)

print('BBBB')
IPython.display.display(img)


print('ZZZ123')
IPython.display.display(wid)

print('OK!')


AAAAA
BBBB
ZZZ123
OK!

Canvas Resizing

Awesome article about resizing canvas and/or displayed element

http://webglfundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html


In [17]:
wid

In [ ]:


In [ ]:


In [ ]:


In [ ]: