Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Draw a grid of horizontal and vertical lines
- # Copyright 2023 Roland Richter [Processing.py]
- from __future__ import division, print_function
- def setup():
- size(800, 560)
- def draw():
- background("#0F0F0F")
- draw_vertical_lines()
- draw_horizontal_lines()
- def draw_vertical_lines():
- """Draw vertical grey lines 40 pixels apart."""
- stroke(92)
- fill(192)
- textSize(12)
- textAlign(CENTER, CENTER)
- # Draw vertical lines, and place a label at the top of each line
- # QUIZ Why is `width+1`, and not `witdh`, used as the stop parameter here?
- for x in range(0, width+1, 40):
- line(x, 0, x, height)
- label = nf(x, 3)
- text(label, x, 12)
- def draw_horizontal_lines():
- """Draw horizontal grey lines 40 pixels apart."""
- stroke(92)
- fill(192)
- textSize(12)
- textAlign(CENTER, CENTER)
- # Draw horizontal lines, and place a label at the left of each line
- # TRY to implement this function in a similar way as above
- for y in range(0):
- line(0, 1, 2, 3)
- label = ""
- text(label, 4, 5)
- # ----------------------------------------------------------------------
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or
- # (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program. If not, see <https://www.gnu.org/licenses/>.
Advertisement
Add Comment
Please, Sign In to add comment