Create a cs100/ch6
folder and save to it the following: wooster-img.jpg.
You will need the cImage
module. To install it, in Thonny select the option Tools -> Manage Packages
. Search for cImage
with that exact capitalization. Click Install
. Close and reopen Thonny.
There are a few minor differences in the usage of this module when compared to the book. Additional examples can be found here. To check that your installation was successful, create a file called setup.py
saved to your cs100/ch6
folder (same location as the image you saved). Copy and paste the following code:
from image import *
myWindow = ImageWin(600, 400, "My Awesome Window")
img = FileImage("wooster-img.jpg")
img.draw(myWindow)
Run it and you should see the image in a new screen.
image
, not cImage
.ImageWin(widthNum, heightNum, nameOfWindowString)
EmptyImage
has white pixels by defaultNo submission is necessary. Just make sure that your program runs correctly to check that the module was installed, because you will need it for the remaining in-class activities.