Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.7.2
-
None
Description
The following code snapshots the title bar incorrectly in the second and third try. Images available at https://stackoverflow.com/q/78717054.
from PySide6.QtCore import QTimer from PySide6.QtWidgets import QApplication, QMainWindow application = QApplication() window = QMainWindow() window.show() screen = window.screen() def save_titlebar(filename: str) -> None: window.screen().grabWindow( window.winId(), x=window.frameGeometry().x() - window.geometry().x(), y=window.frameGeometry().y() - window.geometry().y(), w=window.frameGeometry().width(), h=window.frameGeometry().height() - window.geometry().height(), ).save(filename) def set_width_and_save(width: int) -> None: window.setFixedWidth(width) QTimer.singleShot(500, lambda: save_titlebar(f"titlebar{width}.png")) QTimer.singleShot(1000, lambda: set_width_and_save(400)) QTimer.singleShot(2000, lambda: set_width_and_save(500)) QTimer.singleShot(3000, lambda: set_width_and_save(300)) QTimer.singleShot(4000, window.close) application.exec()