from PyQt6 import QtCore
from PyQt6.QtCore import QUrl,QTimer,Qt
from random import randint

from PyQt6.QtQuick import QQuickView
from PyQt6.QtWidgets import QListWidget, QListWidgetItem, QFrame, QMenu, QAction, QApplication, QInputDialog
from PyQt6.QtGui import QSurfaceFormat, QColor


if __name__ == '__main__':
    import sys

    app = QApplication(sys.argv)

    view = QQuickView()

    # view.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground, False)
    from ctypes import windll, c_int, byref

    windll.dwmapi.DwmExtendFrameIntoClientArea(c_int(view.winId()), byref(c_int(-1)))
    # view.setFlags(Qt.CustomizeWindowHint | Qt.Drawer | Qt.WindowStaysOnTopHint)

    surfaceFormat = QSurfaceFormat()
    surfaceFormat.setAlphaBufferSize(8)
    view.setFormat(surfaceFormat)
    view.setClearBeforeRendering(True)
    view.setColor(QColor(Qt.transparent))

    view.setResizeMode(QQuickView.SizeRootObjectToView)
    view.setSource(QUrl('ACGauge01.qml'))
    tavAltAci = view.rootObject()


    timer = QTimer()
    # Connect it to f
    timer.timeout.connect(lambda: tavAltAci.setProperty("value", randint(0,360)))
    # Call f() every 5 seconds
    timer.start(3000)

    view.show()


    sys.exit(app.exec())
