Update qt screen script to new import schema

update_qt_screen_info_script
Tyler Goodlet 2023-02-02 14:24:41 -05:00
parent f31bd42a19
commit d2e21f45b2
1 changed files with 12 additions and 7 deletions

View File

@ -16,11 +16,15 @@ DPI and info helper script for display metrics.
from pyqtgraph import (
QtGui,
QtWidgets,
)
from PyQt5.QtCore import (
Qt,
QCoreApplication,
Qt,
QCoreApplication,
)
from PyQt5.QtWidgets import (
QWidget,
QMainWindow,
QApplication,
)
# Proper high DPI scaling is available in Qt >= 5.6.0. This attibute
@ -32,9 +36,9 @@ if hasattr(Qt, 'AA_UseHighDpiPixmaps'):
QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
app = QtWidgets.QApplication([])
window = QtWidgets.QMainWindow()
main_widget = QtWidgets.QWidget()
app = QApplication([])
window = QMainWindow()
main_widget = QWidget()
window.setCentralWidget(main_widget)
window.show()
@ -46,7 +50,7 @@ pxr = main_widget.devicePixelRatioF()
# screen = app.screens()[screen_num]
def ppscreeninfo(screen: 'QScreen') -> None:
def ppscreeninfo(screen: QtGui.QScreen) -> None:
# screen_num = app.desktop().screenNumber()
name = screen.name()
size = screen.size()
@ -68,6 +72,7 @@ def ppscreeninfo(screen: 'QScreen') -> None:
print('-'*50 + '\n')
screen = app.screenAt(main_widget.geometry().center())
ppscreeninfo(screen)