generated from mwc/lab_iteration
i changed the size in square too create a line of squares
This commit is contained in:
@@ -11,15 +11,15 @@ from superturtle.movement import no_delay
|
|||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
parser = ArgumentParser("python drawtiles.py", description="Draws a grid of tiles.")
|
parser = ArgumentParser("python drawtiles.py", description="Draws a grid of tiles.")
|
||||||
parser.add_argument("width", type=int, help="How many tiles across the grid should be")
|
parser.add_argument("5", type=int, help="How many tiles across the grid should be")
|
||||||
parser.add_argument("height", type=int, help="How many tiles high the grid should be")
|
parser.add_argument("10", type=int, help="How many tiles high the grid should be")
|
||||||
parser.add_argument("size", type=int, help="Side length of each tile")
|
parser.add_argument("15", type=int, help="Side length of each tile")
|
||||||
parser.add_argument("--fast", action="store_true", help="Skip turtle animation and show the result")
|
parser.add_argument("--fast", action="store_true", help="Skip turtle animation and show the result")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.fast:
|
if args.fast:
|
||||||
with no_delay():
|
with no_delay():
|
||||||
draw_tile_grid(args.width, args.height, args.size, draw_tile)
|
draw_tile_grid(args,5, args,10, args,15, -fast, draw_tile)
|
||||||
else:
|
else:
|
||||||
draw_tile_grid(args.width, args.height, args.size, draw_tile)
|
draw_tile_grid(args.width, args.height, args.size, draw_tile)
|
||||||
input()
|
input()
|
||||||
|
|||||||
18
poetry.lock
generated
Normal file
18
poetry.lock
generated
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# This file is automatically @generated by Poetry 2.3.1 and should not be changed by hand.
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "superturtle"
|
||||||
|
version = "0.2.0"
|
||||||
|
description = "Extensions to Python's turtle"
|
||||||
|
optional = false
|
||||||
|
python-versions = "<4.0,>=3.9"
|
||||||
|
groups = ["main"]
|
||||||
|
files = [
|
||||||
|
{file = "superturtle-0.2.0-py3-none-any.whl", hash = "sha256:ca3a31be3259387b4490846adbf64502acc9d23472912cc43497ab170e89f506"},
|
||||||
|
{file = "superturtle-0.2.0.tar.gz", hash = "sha256:807fb419c1dba9cb809a22a68e72c0193bdeed4a9326eb36ad940b2a7ff6ac04"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[metadata]
|
||||||
|
lock-version = "2.1"
|
||||||
|
python-versions = ">=3.10,<4.0"
|
||||||
|
content-hash = "6aad436bbbf760fa856344262eab22d62a167cac4e5dfefbf4be77d5a37428c9"
|
||||||
18
square.py
18
square.py
@@ -1,17 +1,15 @@
|
|||||||
from turtle import *
|
from turtle import *
|
||||||
|
|
||||||
def square(side_length):
|
def square(side_length):
|
||||||
forward(side_length)
|
for i in range(4):
|
||||||
right(90)
|
forward(side_length)
|
||||||
forward(side_length)
|
right(90)
|
||||||
right(90)
|
|
||||||
forward(side_length)
|
|
||||||
right(90)
|
|
||||||
forward(side_length)
|
|
||||||
right(90)
|
|
||||||
|
|
||||||
sizes = [20, 40, 60, 80, 100]
|
sizes = [20, 40, 60, 80, 100]
|
||||||
for size in sizes:
|
for size in sizes:
|
||||||
square(size)
|
square(20)
|
||||||
input()
|
penup()
|
||||||
|
forward(40)
|
||||||
|
pendown()
|
||||||
|
|
||||||
|
input()
|
||||||
Reference in New Issue
Block a user