drag an arc after creating a line tkinter

328
March 04, 2017, at 12:41 PM

Here was the code to draw a line. Is it possible to let the user drag a line so that it forms a curve?

from tkinter import Canvas, Tk
# Image dimensions
w,h = 640,480
# Create canvas
root = Tk()
canvas = Canvas(root, width = w, height = h, bg = 'white')
canvas.pack()
def on_click(event):
    """ set starting point of the line """
    global x1, y1
    x1 = event.x
    y1 = event.y
def on_click_release(event):
    """ draw the line """
    canvas.create_line(x1, y1, event.x, event.y)
def clear_canvas(event):
    canvas.delete('all')
canvas.bind("<Button-1>", on_click) 
canvas.bind("<ButtonRelease-1>", on_click_release)
root.bind("<Key-c>", clear_canvas)
root.mainloop()

Once again thank youuuuu!!! :)))))

Rent Charter Buses Company
READ ALSO
Either operating on a numeric value or replacing cell with nan

Either operating on a numeric value or replacing cell with nan

In a pandasDataFrame df, let's say I have a column E

388
Determining if a specific, ordered vector is in a list/array

Determining if a specific, ordered vector is in a list/array

I am working on some molecular dynamics using Python, and the arrays tend to get pretty largeIt would be helpful to have a quick check to see if certain vectors appear in the arrays

381
Merging fields in Python [on hold]

Merging fields in Python [on hold]

I have a CSV dataset with 10 columns and thousands of rowsThere are 27 rows with the same incident number

434
Loading method parameters from file

Loading method parameters from file

Assume I have a python function that takes a few parameters:

378