-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfigures.py
64 lines (50 loc) · 1.84 KB
/
figures.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"""
this simple program can make terminal figure output.
Note: that this does not make an app or ui with the figure in it
"""
#imports:
import time
#this is a simple lite program to make a line
def line(flush=bool(True), times=int(15), delay=float(0.1)):
"""
this will make a simple line, just like a loadingbar, but diffrent
flush: just like print, this will look cooler
times: how many times "-" to be printed
delay: this will make a delay before every print, needs flush=True
this will make something like this: ------------------
this uses the default color, so there is no color change
"""
for x in range(times):
print("-", sep="", end="", flush=flush)
time.sleep(delay)
#simple rect that can take in width and height input but it is only in int
def sRect(width=int(10), height=int(10), xPos=int(20), delay=float(0.0)):
"""
This can make a rect, (sRect = simple Rect)
width: a int that sets the width of the triangle
height: a int that sets the height of the triangle
xPos: this will let you .rjust the rectangle
delay: this is to make the rect print the midle slowly
width and height is set to 10 by default, that will make ----------
with an ecual height
"""
#make the top and bottom
t = ""
for x in range(width + 1):
t = t + "-"
#here we print the top
print(t.rjust(xPos))
#this will make the sides
prev = 0
for x in range(height):
s = ""
if prev == 0:
prev = x
elif x - prev == 2:
s = s + ("|" + "|".rjust(width))
#here we print the side
print(s.rjust(xPos))
prev = x
time.sleep(delay)
#here we print the bottom
print(t.rjust(xPos))