import sys
from PyQt5.QtCore import QTimer, Qt
from lxml import etree
from PyQt5 import QtSvg
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout


def turn_to(val):
    if val:
        ribbon1.set("display", "none")
    else:
        ribbon1.set("display", "inline")
    svgWidget.load(etree.tostring(svg_root))


def toggle():
    global flag
    flag = not flag
    turn_to(flag)


svg_root = etree.parse(r"5803025115_rev1.svg")

ribbon1 =svg_root.findall('''.//*[@id='RIBBON1']''')[0]
svg_str = etree.tostring(svg_root)

app = QApplication([])
window = QWidget()
layout = QVBoxLayout()
flag = 0
timer=QTimer()
timer.timeout.connect(toggle)
timer.start(1000)
svgWidget = QtSvg.QSvgWidget()
svgWidget.load(etree.tostring(svg_root))

layout.addWidget(svgWidget)
window.setLayout(layout)
window.show()


sys.exit(app.exec_())