Create an arc with Python and tkinter in a canvas

Here’s how to create an arc with tkinter.

import tkinter as tk

root = tk.Tk()

canvas = tk.Canvas(root, width=400, height=400)
canvas.pack()

coord = 10, 50, 240, 210
arc = canvas.create_arc(coord, start=30, extent=120, style=tk.ARC, width=3)

root.mainloop()

The result

 

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.