【发布时间】:2014-10-18 19:46:18
【问题描述】:
我不知道如何使用while 循环来扫描所有像素。
我可以使用 for 循环来做到这一点,但如何只使用 while 循环来做到这一点??
for x in range(0,width):
for y in range(0,height):
px = getPixels(pic,x,y)
________________________________
def question410():
pic = makePicture(getMediaPath("barbara.jpg"))
width = getWidth(pic)
height = getHeight(pic)
canvas = makeEmptyPicture(width,height)
explore(pic)
scale = 2
x = 0
y = 0
while x < width:
while y < height:
px = getPixel(pic,x,y)
colour = getColor(px)
tgtPx = getPixel(canvas,x,y)
setColor(tgtPx,colour)
x=x+1
y=y+1
print x, y
explore(canvas)
【问题讨论】:
-
您是否尝试过使用
while循环自己编写代码?如果有,请分享。 -
我正在学习在 JES 中执行此操作。我尝试过类似 while x
标签: jes