Fixing the ratio of width and height in the QMainWindow Component(PyQt 6.4)
-
I was trying to makea window which has a ratio of 16:9, so I tried to use 'setHeightForWidth' and 'heightForWidth', but I failed. So is there anything that I can try? My main window code looks like this...
class MainWindow(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("iPhone Reinforcement") monitor = None for m in get_monitors(): if m.is_primary: print(f'Monitor detected: {str(m)}') monitor = m break if monitor != None: print(str(m)) self.resize(QSize(int(monitor.width/2), int(monitor.height/2)))