Reputation:
I am trying to interweave two pictures.
Picture 1 Picture 2
To This
def interWeave(pic, picture):
w=getWidth(pic)
h=getHeight(pic)
newPic=makeEmptyPicture(w,h)
for x in range (0,w):
for y in range (0,h):
p=getPixel(pic,x,y)
p2=getPixel(picture,x,y)
newPxl=getPixel(newPic,x,y)
if (x>=0 and x<20) or (x>=40 and x<60)or (x>=80 and x<=100):
color = getColor(p)
else:
color=getColor(p2)
setColor(newPxl, color)
return (newPic)
But I get this:
Anyone know what I'm doing wrong?
Upvotes: 0
Views: 343
Reputation: 8610
if (x>=0 and x<20) or (x>=40 and x<60)or (x>=80 and x<=100):
color = getColor(p)
else:
color=getColor(p2)
setColor(newPxl, color)
If your indentatin is right, you only setColor
in the else block. So the range from 0~20, 40~60, 80~100 will be blank.
Upvotes: 3