mode = None list = [] x = y = w = h = 0 name = None def flush(): global x, y, w, h, name if mode == 'rect': list.append((x,y,w,h,'box',name)) if mode == 'circle': x = cx - rx y = cy - ry w = rx * 2 h = ry * 2 list.append((x,y,w,h,'circle',name)) x = y = w = h = 0 name = None for line in open("boxes.svg").readlines(): line = line.strip() if line == "') print('
') print('') for (x,y,w,h,c,name) in list: x = round(x/4) - 1 y = round(y/4) - 1 w = round(w/4) + 2 h = round(h/4) + 2 print(f'
{name}
') print('
') #print_html() print_list()