Fit BMP Splash to Screen
Solved
Qt for Python
-
Hello everybody,
i have adjusted/written some code to show a splash image of a BMP file which has a fixed Size/Resolution.
In my case it is 2248, 1383If i run my simple code i have attached, i get a splash of the bmp on my Monitor. But i want to fit the BMP to the monitor size.
Do you think this is possible since the monitor is 1980x1080 and the BMP 2248x1383?
I tried to find the specific QT modules but couldnt get anything running to fit/scale it to the window size.
Does anyone know what i can do? And maybe give some code examples?BR
Daniel
import time import sys from PyQt6.QtWidgets import QApplication, QLabel, QSplashScreen from PyQt6.QtGui import QPixmap, QCursor from PyQt6.QtCore import Qt import os start_time = time.time() app = QApplication(sys.argv) total_loops = 1 for i in range(total_loops): s = app.screens()[0] # Get the right screen # Display info about secondary screen print('Screen Name: {} Size: {}x{} Available geometry {}x{} '.format(s.name(), s.size().width(), s.size().height(), s.availableGeometry().width(), s.availableGeometry().height())) # Select desired image to be displayed pixmap = QPixmap('layer0000.bmp') print(pixmap.size()) # show pixmap size # Splash screen approach splash = QSplashScreen(pixmap) # Set the splash screen to desired image splash.showFullScreen() # Show the splash screen splash.windowHandle().setScreen(s) # Set splash screen to secondary monitor time.sleep(2) end_time = time.time() print('Execution time: ', end_time - start_time ) sys.exit(app.exit())