from PIL import Image from PIL import ImageDraw image = Image.new('RGB',(91,91),'blue') draw = ImageDraw.Draw(image) draw.ellipse((0,0,90,90),'yellow','blue') # face draw.ellipse((25,20,35,30),'yellow','blue') # left eye draw.ellipse((28,25,32,30),'blue','blue') # left ... draw.ellipse((50,20,60,30),'yellow','blue') # right eye draw.ellipse((53,25,58,30),'blue','blue') # right ... draw.arc((40,50,50,55), 0, 360, 0) # nose draw.arc((20,40,70,70), 0, 180, 0) # smile image.show()
Widgets for Jupyter notebook ¶ Let's import the module ipywidgets into the Jupyter Notebook from ipywidgets import widgets from ipywidgets import * from traitlets import * Now we import the display function from IPython ¶ let's attach a function to the event on_submit After we run this cell, we can go up and write something in the text widget and after you submit the text you wrote will be printed after the cell from IPython.display import display text = widgets . Text () display ( text ) def handle_submit ( sender ): print ( "Thank you for entering this text:" , text . value ) text . on_submit ( handle_submit ) Thank you for entering this text: Ciao
Comments
Post a Comment