调整窗口大小设置,改为根据屏幕分辨率动态调整

This commit is contained in:
marques
2025-05-15 15:08:14 +08:00
parent 3511b94c28
commit f71289bb4c

View File

@ -1,6 +1,7 @@
from pathlib import Path
from PySide6.QtWidgets import QMainWindow, QMessageBox, QFileDialog
from PySide6.QtGui import QGuiApplication
from matplotlib import use
from yaml import dump, load, FullLoader
@ -34,7 +35,15 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.ui = Ui_Signal_Label()
self.ui.setupUi(self)
self.setFixedSize(720, 1080) # 设置固定大小,禁止缩放
# self.setFixedSize(720, 1080) # 设置固定大小,禁止缩放
# 获得屏幕分辨率以34比例设置窗口大小
screen = QGuiApplication.primaryScreen()
size = screen.availableGeometry()
screen_height = size.height()
window_height = int(screen_height * 0.75)
window_width = int(window_height * 1 / 2)
self.resize(window_width, window_height)
# 消息弹窗初始化
self.msgBox = QMessageBox()