I want to let user to draw an oval shape in the canvas of tkinter.
current_x = 0
current_y = 0
def select_color(col):
global pen_color
pen_color = col
def locate_xy(work):
global current_x, current_y
current_x = work.x
current_y = work.y
def addLine(work):
global current_x, current_y
canvas.create_line((current_x, current_y, work.x, work.y), width=pen_size.get(), fill=pen_color,
capstyle=ROUND,
smooth=TRUE)
current_x, current_y = work.x, work.y
def addoval(work):
global current_x, current_y
canvas.create_oval(current_x, current_y, work.x, work.y,fill= pen_color,outline=pen_color)
current_x, current_y = work.x, work.y
the create_line works just fine. but the oval return this error:
TypeError: addoval() missing 1 required positional argument: 'work'
I call it later :
oval_shape = PhotoImage(file="oval.png")
oval_draw = Button(window, image=oval_shape, bg="#f2f3f5", command=addoval, relief=RIDGE)
oval_draw.place(x=3, y=343)
it's a button that when user click it the addoval will be activated
