Skip to content

Commit 49b58c6

Browse files
committed
implemented error handling for wrong values
1 parent 7cfca27 commit 49b58c6

File tree

8 files changed

+323
-273
lines changed

8 files changed

+323
-273
lines changed

geo/__pycache__/basic.cpython-313.pyc

-338 Bytes
Binary file not shown.
116 Bytes
Binary file not shown.

geo/basic.py

+32-43
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,46 @@
22

33
blk = (0,0,0)
44

5-
def rect(height : float, length : float, fill, source):
6-
t = turtle.Turtle()
5+
def rect(height: int, length: int, fill: bool, source):
6+
rt = turtle.Turtle()
7+
rt.hideturtle()
8+
rt.penup()
9+
rt.goto(0, 0)
10+
rt.setheading(0)
11+
rt.pendown()
12+
rt.speed(0)
13+
if fill and source:
14+
rt.color(source)
15+
rt.begin_fill()
16+
else:
17+
rt.color(source if source else blk)
18+
for _ in range(2):
19+
rt.forward(length)
20+
rt.left(90)
21+
rt.forward(height)
22+
rt.left(90)
23+
if fill and source:
24+
rt.end_fill()
25+
26+
27+
28+
def carr(cote : int, fill, source):
29+
ct = turtle.Turtle()
30+
ct.speed(0)
731
if source == None:
8-
t.color(blk)
32+
ct.color(blk)
933
elif fill == True and bool(source) == True:
1034
fcolor = source
11-
t.color(fcolor)
12-
t.begin_fill()
13-
14-
t.forward(length)
15-
t.left(90)
16-
t.forward(height)
17-
t.left(90)
18-
t.forward(length)
19-
t.left(90)
20-
t.forward(height)
21-
if fill:
22-
t.end_fill()
23-
24-
25-
def carr(cote : float, fill, source):
26-
t = turtle.Turtle()
27-
if source == None:
28-
t.color(blk)
29-
elif fill == True and bool(source) == True:
30-
fcolor = source
31-
t.color(fcolor)
32-
t.begin_fill()
35+
ct.color(fcolor)
36+
ct.begin_fill()
3337

3438
for x in range(0, 5):
35-
t.forward(cote)
36-
t.left(90)
39+
ct.forward(cote)
40+
ct.left(90)
3741
if fill == True:
38-
t.end_fill()
42+
ct.end_fill()
3943

4044

41-
def triang(cote : float, fill, source):
42-
t = turtle.Turtle()
43-
if source == None:
44-
t.color(blk)
45-
elif fill == True and bool(source) == True:
46-
fcolor = source
47-
t.color(fcolor)
48-
t.begin_fill()
49-
50-
for x in range(1, 4):
51-
t.forward(cote)
52-
t.left(360 / 3)
53-
if fill == True:
54-
t.end_fill()
55-
5645

5746
def circle(rad, fill, source):
5847
t = turtle.Turtle()

geo/triangles.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@
44
blk = (0,0,0)
55

66
def tri_equi(cote, fill, source):
7-
t = turtle.Turtle()
7+
trit = turtle.Turtle()
8+
trit.speed(0)
9+
trit.hideturtle()
810
if source == None:
9-
t.color(blk)
11+
trit.color(blk)
1012
elif fill == True and bool(source) == True:
1113
fcolor = source
12-
t.color(fcolor)
13-
t.begin_fill()
14+
trit.color(fcolor)
15+
trit.begin_fill()
1416

1517
for x in range(1, 4):
16-
t.forward(cote)
17-
t.left(360 / 3)
18+
trit.forward(cote)
19+
trit.left(360 / 3)
1820
if fill == True:
19-
t.end_fill()
21+
trit.end_fill()
2022

2123
def tri_iso(side, base, fill, source):
2224
t = turtle.Turtle()

gui.py

-223
This file was deleted.

0 commit comments

Comments
 (0)