Python For Kids (Part 4: FUN With Images)
For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in addition to the topics it will cover. https://github.com/mytechnotalent/Python-For-Kids
Today we are going to make some FUN little images for our little friend to make and interact with us.
STEP 1: Open Mu IDE
STEP 2: Type Code
STEP 3: Click Save
STEP 4: Save File - main.py - Desktop
STEP 5: Click Flash
STEP 6: SEE THE FUN AS OUR NEW FRIEND MAKES A SMILE AT US!
(Look at the front of the badge to see the image.)
STEP 7: Let's Create Our OWN Image!
Let's create our very OWN shape! Each LED pixel on the physical display can be set to one of ten values. If a pixel is set to 0 (zero) then it’s off. It literally has zero brightness. However, if it is set to 9 then it is at its brightest level. The values 1 to 8 represent the brightness levels between off (0) and full on (9).
Let's create a little house. We can start by overwriting our main.py file like this.
STEP 8: Click Save
STEP 9: Save File - main.py - Desktop
STEP 10: Click Flash
STEP 11: SEE THE FUN AS WE JUST MADE A LITTLE HOUSE!
(Look at the front of the badge to see the image.)
It's your turn! Ask our little friend to draw some of his other favorite images for you! You can try something like this on line 3 by replacing line 3 in our code with one of the below statements to which you will SAVE and FLASH as described above.
Here’s a list of the built-in images:
- display.show(Image.HEART)
- display.show(Image.HEART_SMALL)
- display.show(Image.SMILE)
- display.show(Image.SAD)
- display.show(Image.CONFUSED)
- display.show(Image.ANGRY)
- display.show(Image.ASLEEP)
- display.show(Image.SURPRISED)
- display.show(Image.SILLY)
- display.show(Image.FABULOUS)
- display.show(Image.MEH)
- display.show(Image.YES)
- display.show(Image.NO)
- display.show(Image.TRIANGLE)
- display.show(Image.TRIANGLE_LEFT)
- display.show(Image.CHESSBOARD)
- display.show(Image.DIAMOND)
- display.show(Image.DIAMOND_SMALL)
- display.show(Image.SQUARE)
- display.show(Image.SQUARE_SMALL)
- display.show(Image.RABBIT)
- display.show(Image.COW)
- display.show(Image.MUSIC_CROTCHET)
- display.show(Image.MUSIC_QUAVER)
- display.show(Image.MUSIC_QUAVERS)
- display.show(Image.PITCHFORK)
- display.show(Image.XMAS)
- display.show(Image.PACMAN)
- display.show(Image.TARGET)
- display.show(Image.TSHIRT)
- display.show(Image.ROLLERSKATE)
- display.show(Image.DUCK)
- display.show(Image.HOUSE)
- display.show(Image.TORTOISE)
- display.show(Image.BUTTERFLY)
- display.show(Image.STICKFIGURE)
- display.show(Image.GHOST)
- display.show(Image.SWORD)
- display.show(Image.GIRAFFE)
- display.show(Image.SKULL)
- display.show(Image.UMBRELLA)
- display.show(Image.SNAKE)
Feel free to share your code in the comments below! I would LOVE to see what YOU create!
In our next lesson we will have some FUN with numbers!