Skip to content

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

Open
@sjune843

Description

@sjune843

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='')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions