Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6890561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:17:53+00:00 2026-05-27T06:17:53+00:00

Google though I tried, I cannot seem to figure out how to get rid

  • 0

Google though I tried, I cannot seem to figure out how to get rid of the white border I’m getting around a png I’m serving to a QSplashScreen.

I’ve seen this article, but I don’t know how to translate that to PyQt, or whether that’s even what I want.

I’ve even tried setting a black and white mask separately which achieved a low-quality result with lots of dots everywhere.

Has anybody figured out the magical translucent/semi-transparent SplashScreen that you can also feed text data to, ala the showMessage command? Thanks in advance.

I should mention this is Windows 7 as well.

The following are both a test PNG that I’m using as the splash image as well as the resulting ugly white border I get with it:

Splash Image
Result in Windows 7

An alternate method of providing a black and white alpha through QBitmap yields this closer, but uglier example with strange dots abound. The code and images follow.

    splash_pix = QPixmap(":/images/images/PyQtSplash.png")
    splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
    splash.setMask(QBitmap(QPixmap(":/images/images/PyQtSplashAlpha.jpg")))

Splash Alpha
QBitmap Result

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:17:53+00:00Added an answer on May 27, 2026 at 6:17 am

    So long as you use an image with clean transparent areas, it should only be necessary to pass a mask of it to QSplashScreen.setMask.

    This script works as expected for me on Linux:

    from PyQt4 import QtGui, QtCore
    
    def show_splash(path):
        image = QtGui.QPixmap(path)
        splash = QtGui.QSplashScreen(image)
        splash.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        splash.setMask(image.mask())
        font = QtGui.QFont(splash.font())
        font.setPointSize(font.pointSize() + 5)
        splash.setFont(font)
        splash.show()
        QtGui.QApplication.processEvents()
        for count in range(1, 6):
            splash.showMessage(splash.tr('Processing %1...').arg(count),
                               QtCore.Qt.AlignBottom | QtCore.Qt.AlignLeft,
                               QtCore.Qt.white)
            QtGui.QApplication.processEvents()
            QtCore.QThread.msleep(1000)
    
    if __name__ == '__main__':
    
        import sys
        app = QtGui.QApplication(sys.argv)
        show_splash(sys.argv[1])
        app.quit()
    

    EDIT

    This custom SplashScreen class should produce reasonable results on both Linux and Windows:

    from PyQt4 import QtGui, QtCore
    
    class SplashScreen(QtGui.QWidget):
        def __init__(self, pixmap):
            QtGui.QWidget.__init__(self)
            self._pixmap = pixmap
            self._message = QtCore.QString()
            self._color = QtGui.QColor.black
            self._alignment = QtCore.Qt.AlignLeft
            self.setWindowFlags(QtCore.Qt.FramelessWindowHint |
                                QtCore.Qt.WindowStaysOnTopHint)
            self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
            self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
            self.setFixedSize(self._pixmap.size())
            self.setMask(self._pixmap.mask())
    
        def clearMessage(self):
            self._message.clear()
            self.repaint()
    
        def showMessage(self, message, alignment=QtCore.Qt.AlignLeft,
                                       color=QtGui.QColor.black):
            self._message = QtCore.QString(message)
            self._alignment = alignment
            self._color = color
            self.repaint()
    
        def paintEvent(self, event):
            textbox = QtCore.QRect(self.rect())
            textbox.setRect(textbox.x() + 5, textbox.y() + 5,
                            textbox.width() - 10, textbox.height() - 10)
            painter = QtGui.QPainter(self)
            painter.drawPixmap(self.rect(), self._pixmap)
            painter.setPen(QtGui.QColor(self._color))
            painter.drawText(textbox, self._alignment, self._message)
    
        def mousePressEvent(self, event):
            self.hide()
    
    def show_splash(path):
        image = QtGui.QPixmap(path)
        splash = SplashScreen(image)
        font = QtGui.QFont(splash.font())
        font.setPointSize(font.pointSize() + 5)
        splash.setFont(font)
        splash.show()
        QtGui.QApplication.processEvents()
        for count in range(1, 6):
            splash.showMessage(splash.tr('Processing %1...').arg(count),
                               QtCore.Qt.AlignCenter, QtCore.Qt.white)
            QtGui.QApplication.processEvents()
            QtCore.QThread.msleep(1000)
        splash.hide()
        splash.close()
    
    if __name__ == '__main__':
    
        import sys
        app = QtGui.QApplication(sys.argv)
        show_splash(sys.argv[1])
        app.quit()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just tried to use Google Map Buddy to get satellite image from Google
I have tried several different examples but I cannot get any video to show.
I am really struggling with this one. I have Google'd this and tried most
Please help me figure this out. I apologize if this is a duplicate question,
I thought this question was asked before but I tried Google but didn't find
I am trying to send email using smtp authentication through google but I am
I am currently working on a simple web application through Google App engine using
I am trying to build a little javascript class for geocoding addresses trough Google
I've read through the Google Spreadsheets API PHP documentation. All examples are using Zend,
I've asked Google and searched through the NServiceBus website and forums, but I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.