Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to run the def(event) function only twice in python tkinter #1163

Open
sjune843 opened this issue Oct 27, 2023 · 0 comments
Open

I want to run the def(event) function only twice in python tkinter #1163

sjune843 opened this issue Oct 27, 2023 · 0 comments

Comments

@sjune843
Copy link

I want to make sure the following code runs only twice.

I'm making a drone simulator. And I was making a program in Python tkinter to make a drone move between two points using a canvas. I am asking this question because I would like to take pictures only twice rather than taking pictures of two points indefinitely. I used unbind but it didn't work. I tried using methods other than stop() to terminate the function, but it didn't work. It's very difficult because Python is not my main skill. help.

code :
def start_point(event):
x1, y1 = ( event.x-1 ), ( event.y-1 )
x2, y2 = ( event.x+1 ), ( event.y+1 )
canvas.create_oval(x1, y1, x2, y2,width=10, fill='blue', outline='blue')

canvas.bind("", start_point,add='')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant