I am new to python and have been shown 'drivers' for running functions without entering them into the command line,
I don`t understand the concept of drivers or how to type them out correctly, any kind of feedback on how to use them would be great!.
What I don't understand is how entering the function makeGreyscaleThenNegate(pic) can call the def function makeGreyscaleThenNegate(picture): when the input values are different (pic) versus (picture). (I guess this is because I don't know how the 'driver' function works.)
Here is what i've been shown
def driverGrey():
pic=makePicture(pickAFile())
repaint(pic)
makeGreyscaleThenNegate(pic)
repaint(pic)
def makeGreyscaleThenNegate(picture):
for px in getPixels(picture):
lum=(getRed(px)+getGreen(px)+getBlue(px)/3
lum=255-lum
setColor(px,makeColor(lum,lum,lum))
My belief is for this to work,(pic) would already have been named/defined prior to creating the 'driver' function? I just am not sure how (pic) and (picture) are referring to the same file, or am I completely mis-interpreting this..