import turtle as t import random import sys # get required modules try: import pip pip.main(['install', 'PySimpleGUI']) except Exception as e: print("Pip not found") print(e) sys.exit(1) import PySimpleGUI as sg terminal_colors = { "RESET": "\033[0m", "RED": "\033[1;31;40m", "GREEN": "\033[1;32;40m", } stars = [ { "rotation": 0, "color": "red", }, { "rotation": 36, "color": "blue", }, { "rotation": 36, "color": "green", }, { "rotation": 36, "color": "yellow", }, { "rotation": 36, "color": "purple", }, { "rotation": 36, "color": "pink", }, { "rotation": 36, "color": "orange", }, { "rotation": 36, "color": "black", }, { "rotation": 36, "color": "white", }, { "rotation": 36, "color": "grey", }, { "rotation": 36, "color": "brown", } ] firstMessages = [ "YOU", "ARE", ] def main(skipoptions): skips = { "star": False, "spiral": False, } if skipoptions: skips = skipoptions # create a star t.setup(800, 600) t.begin_fill() t.speed(1) t.penup() if not skips["star"]: t.goto(0, 300) t.pendown() for message in firstMessages: # add delay t.speed(1) # align center top t.write(message, align='center', font=('Arial', 48, 'normal')) t.penup() t.goto(0, t.ycor() - 50) t.pendown() t.speed(10) t.penup() t.goto(0, 0) t.speed(30) # go trough the stars for star in stars: t.penup() t.goto(0, 0) t.pendown() t.right(star["rotation"]) t.color(star["color"], star["color"]) t.begin_fill() for i in range(5): t.forward(200) t.right(144) t.end_fill() t.penup() t.goto(0, -300) t.pendown() t.color('black') # t.write('You are NOT a star', align='center', font=('Arial', 48, 'normal')) # switch trough texts meessages = [ "NOT", "A", "STAR" ] for message in meessages: # add delay t.speed(1) t.write(message, align='center', font=('Arial', 48, 'normal')) t.penup() t.goto(0, t.ycor() - 50) t.pendown() # change background color # clear the screen if not skips["spiral"]: t.clear() # creat a spiral t.speed(10) t.penup() t.goto(0, 0) t.pendown() t.color('black') t.speed(30) rangeset = 1500 for i in range(rangeset): # random color color = random.randint(0, 0xFFFFFF) print(f"color: {color}") t.color("#%06x" % color) # t.color(1 - i / rangeset, 1 - i / rangeset, 1 - i / rangeset) t.speed(100) t.forward(i) t.right(144) t.penup() t.done() pass def setupui(): opts = { "star": False, "spiral": False, } layout = [ [sg.Checkbox('Skip Star', default=False, key='skipstar')], [sg.Checkbox('Skip Spiral', default=False, key='skipspiral')], [sg.Button('Ok')] ] window = sg.Window('Skip Options', layout) while True: event, values = window.read() if event in (None, 'Cancel'): break if event == 'Ok': opts["star"] = values['skipstar'] opts["spiral"] = values['skipspiral'] break window.close() return opts if __name__ == '__main__': skipoptions = setupui() print(skipoptions) try: main(skipoptions) except Exception as e: print(f"{terminal_colors['RED']}[ERROR]{terminal_colors['RESET']}") print(e) pass