This is a branch from my main code of a lottery ticket generator. The purpose of these two functions: (1) drawButton(length) to create rectangular buttons. (2) createMenu() to call drawButton(length) and to fill the buttons with labels.
My issue is when the main code attempts to return to the main menu, it runs turtle.clearscreen(). Shortly after writing the main menu, it did not draw the first rectangle/button.
Let me know if you guys get a different result than I do.
import turtle
import time
t1 = turtle.Turtle()
t1.speed(0)
t1.penup()
def drawButton(length):
length1 = length*5
for i in range(2):
t1.fd(length1)
t1.lt(90)
t1.fd(length)
t1.lt(90)
def createMenu():
t1.sety(-13)
down = t1.ycor()
for i in range(4):
t1.goto(-150, down)
t1.pendown()
drawButton(60)
t1.penup()
down = t1.ycor()-100
createMenu()
time.sleep(2)
turtle.clearscreen()
createMenu()
turtle.done()
This is what the program should draw on the second function call: