Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Fit BMP Splash to Screen

Fit BMP Splash to Screen

Scheduled Pinned Locked Moved Solved Qt for Python
qt for pythonpythonpyside
2 Posts 1 Posters 497 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mullman1
    wrote on 8 Feb 2022, 10:11 last edited by
    #1

    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, 1383

    If 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())
    
    1 Reply Last reply
    0
    • M Offline
      M Offline
      mullman1
      wrote on 8 Feb 2022, 10:32 last edited by
      #2

      Okay. I found a solution myself by using the following command...
      Should be solved for now :D

      pixmap2 = pixmap.scaled(1920, 1080)

      1 Reply Last reply
      0

      2/2

      8 Feb 2022, 10:32

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved