Push button problem


Joined
Feb 14, 2022
Messages
33
Reaction score
2
i am making my first app i have done graphics now I am doing buttons I have done the graphics for the buttons and it worked but the function is not working so to make a button clickable you need to write "turtle.onclick()" but when I write it ,it says there is a word I have not added "fun" so I write
"turtle.onclick(fun)" and it says fun is not recognized to make it less confusing I will show the code:
import turtle

t = turtle.Turtle()
t.hideturtle()

for i in range(2):
t.forward(80)
t.left(90)
t.forward(30)
t.left(90)

t.penup()
t.goto(7, 6)
t.write("Start/Run", font=("Arial",12,"normal"))
def Button_click():
if Button_x<=x<=Button_x+Buttonlength:
if Button_y<=y<=Button_yButtonWidth:
print("clicked")

t.onclick(button_click)
t.mainloop()

can someone plz help me with this problem
I do coding in python and I am nine years old


Reply
Report
 
Ad

Advertisements

Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top