I have a canvas
:
window = tk.Tk()
canvas = tk.Canvas(window,
width=width,
height=height,
bg='black')
With an oval
:
canvas.create_oval(x1, y1, x2, y2, fill='red')
Is it possible to label this oval as such:
*Keep in mind the oval in this image has a line coming out which is irrelevant to this question
One way to do it is to use create_text
:
x = abs((x1-x2)/2)
y = abs((y1-y2)/2)
oval_label = canvas.create_text((x, y), text="Label text")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.