hPyT v1.3.0 #13
Zingzy
announced in
Announcements
Replies: 2 comments 15 replies
|
could you also please add a function to get the current color used by hPyT so you could synchronize other elements with it? |
8 replies
|
cool it seems to work! Though I maybe too stupid to use it. So like I said I wanted to create a progressbar which changes color in sync with your rainbow title bar. So I created this simple code for testing purposses: import sys
from PyQt6.QtWidgets import QApplication, QMainWindow, QProgressBar, QVBoxLayout, QWidget
from PyQt6.QtCore import QTimer
import qdarktheme
from hPyT import rainbow_title_bar
class RainbowProgressBar(QProgressBar):
def __init__(self, *args, interval=100, color_stops=5, **kwargs):
super().__init__(*args, **kwargs)
self.setTextVisible(False)
self.interval = interval
self.color_stops = color_stops
self.timer = QTimer()
self.timer.timeout.connect(self.update_color)
self.timer.start(interval)
self.setStyleSheet("QProgressBar::chunk { background-color: rgb(255, 0, 0); }")
def update_color(self):
color = rainbow_title_bar.get_current_color()
r = (color >> 16) & 0xFF
g = (color >> 8) & 0xFF
b = color & 0xFF
self.setStyleSheet(f"QProgressBar::chunk {{ background-color: rgb({r}, {g}, {b}); }}")
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Rainbow ProgressBar hPyT sync")
self.setGeometry(100, 100, 600, 400)
qdarktheme.setup_theme("dark")
self.progress = RainbowProgressBar(self)
self.progress.setGeometry(50, 50, 500, 50)
self.progress.setRange(0, 100)
self.progress.setValue(50) # Example progress
layout = QVBoxLayout()
layout.addWidget(self.progress)
container = QWidget()
container.setLayout(layout)
self.setCentralWidget(container)
if __name__ == "__main__":
app = QApplication(sys.argv)
# Start the rainbow title bar effect for the window
window = MainWindow()
hwnd = int(window.winId())
rainbow_title_bar.start(window, interval=1, color_stops=5) # Example interval and stops
window.show()
sys.exit(app.exec())The problem is that even if I set the interval to the same value the colors aren't the same - so while searching for a solution I found a weird bug that I think could be the source of it why it isn't working: changing the interval of the ProgressBar class does influence how fast is the color of the title bar changing. video.mp4 |
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Changelog
v1.3.0
For detailed information and previews please refer the README.md file
This discussion was created from the release hPyT v1.3.0.
All reactions