I have created this semi-circle which takes values from Arduino(Serial) and then rotates according to those values. The problem is that Tkinter canvas keeps the old circle as well. I canvas to just show me the new one and removes the old one. The code is attached below.
import serial
import time
from tkinter import *
import math
#-----------------------------------------------
ser = serial.Serial('COM5',baudrate = 9600)
ser.flushInput()
#-----------------------------------------------
def tilt():
ser_bytes = int(ser.readline().decode('ascii'))
adata = (ser.readline().strip())
ser_bytes = str(adata.decode('utf-8'))
angle = int(ser_bytes)-247
arc = c.create_arc(50, 50, 200, 200,start =angle,extent=-180, fill="red")
c.delete(arc)
root.after(100,tilt)
print('X: {}' .format(ser_bytes))
root = Tk()
root.title("Control Panel")
root.geometry('1200x750')
frame_1 = Frame(root)
frame_1.pack()
c = Canvas(frame_1,width = 1000, height = 1000, bg = '#5F9EA0')
c.pack()
tilt()
root.mainloop()