Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import terminal
- terminal.init()
- def draw_line(r, g, b):
- terminal.set_background(r, g, b)
- for _ in range(80):
- terminal.print(" ")
- def canvas(lines):
- is_red = True
- for _ in range(lines):
- if is_red:
- draw_line(220, 20, 60)
- else:
- draw_line(255, 255, 240)
- is_red = not is_red
- def draw_star_line(len, starts_with_star):
- terminal.set_background(25, 25, 112)
- terminal.print(" ")
- is_star = starts_with_star
- # -2 for two spaces on the border
- for _ in range(len - 2):
- if is_star:
- terminal.print("╬")
- else:
- terminal.print(" ")
- is_star = not is_star
- terminal.print(" ")
- def canvas_of_stars(lines, len):
- starts_with_star = True
- for y in range(lines):
- terminal.set_xy(0, y)
- draw_star_line(len, starts_with_star)
- starts_with_star = not starts_with_star
- canvas(25)
- canvas_of_stars(12, 35)
- terminal.waitkey()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement