I have this code below where I have to make it a function. I'm confused.
I tried
def drawLine(img):
....
....
....
Do I set the location of the picture as my variable? and then calling it? How would I call my
parameter when I want to check the code? I'm confused on this..
The code is below.
from cImage import*
import random
def drawLine(img):
myImWin = ImageWin("Line Image", 300, 300)
lineImage = EmptyImage(300,300)
redPixel = Pixel(255,0,0)
randomRed = Pixel(random.randint(0,255),0,0)
for i in range(300):
for x in range(250):
lineImage.setPixel(50,i,redPixel)
lineImage.setPixel(150,x,randomRed)
lineImage.draw(myImWin)
lineImage.save("lineImage.gif")
myImWin.exitonClick()