0

到目前为止,这是我的代码,我的问题是如何使白色网格线变粗并使它们相隔 25 像素?请帮忙

def grid():
  picture = makeEmptyPicture(365,365,black)
  w = getWidth(picture)
  h = getHeight(picture)
  vertical = 25
  horizontal = 25
  for y in range(0,h):
    for x in range(0,w):
      if (x % horizontal ==0 or y % vertical == 0):
      px = getPixel(picture,x,y)
      setColor(px, white)
  show(picture)
  return picture
4

1 回答 1

0

为了使您的线条更大,请尝试同时绘制 2 条线。例如

px1 = getPixel(picture, x, y+1)
px2 = getPixel(picture, x, y+1)
setColor(px1, white)
setColor(px2, white)

这将使沿 X 轴的线变大。

至于保持线条相隔 25 像素,请尝试在每次迭代后将外循环增加 26。

于 2014-06-18T01:42:42.153 回答