so im making a simple game in turtle (title and title2 are variables) onkeypress() makes it possible to stop secret() which I don't want, and if I would add more to main() pressing the spacebar again would reset everything in main().
import turtle
TS = turtle.Screen()
TS.title('Cookie Collector') # Window title
TS.bgcolor('lightyellow') # Window bg color
TS.setup(width=900, height=700) # Window size pixels
TS.tracer(0) # Window updates
def main():
title.clear()
title2.clear()
TS.bgcolor('lightgreen')
def secret():
title.clear()
title2.clear()
TS.bgcolor('black')
title.color('white')
title2.color('white')
title.write("haha epic secret", align='center', font=('Kristen ITC', 40, 'normal'))
title2.write("oOoooOoooOOoOOOOOoooOoOO", align='center', font=('Kristen ITC', 40, 'normal'))
TS.listen()
TS.onkeypress(main, 'space')
TS.onkeypress(secret, 'Up')
while True:
TS.update()