So I'm displaying my app on an external raspberry pi display but it is running the app on landscape. I want to display it in a portrait orientation with every subwidget inside to be in a portrait orientation automatically hopefully with only manipulating the QMainWindow.
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Saaf")
self.setGeometry(0, 0, 480, 800) # Adjust the resolution based on your screen size
self.setWindowFlag(Qt.FramelessWindowHint) # Remove window frame
self.setWindowFlag(Qt.WindowStaysOnTopHint) # Keep the window on top
self.setFixedWidth(480) # Set the fixed width to enforce portrait orientation
self.setFixedHeight(800) # Set the fixed height to enforce portrait orientation
self.setStyleSheet(
"""
QMainWindow {
background-color: #51b09f;
background-image: url('Images/icons10-recycle-500.png');
background-repeat: no-repeat;
background-position: center;
}
"""
)
#set Title Screen
self.screen1=TitleScreen()
self.setCentralWidget(self.screen1)
if __name__ == '__main__':
app = QApplication([])
window = MainWindow()
window.showFullScreen()
sys.exit(app.exec_())