[python-win32] Win API call to display a BMP/PNG file as a splash screen for a console app?

Tony Cappellini cappy2112 at gmail.com
Mon Mar 22 23:47:47 CET 2010


From: python at bdurham.com
To: "zz Python Win32 Newsgroup" <python-win32 at python.org>
Subject: [python-win32] Win API call to display a BMP/PNG file as a
       splash screen for a console app?
Message-ID: <1269295703.32357.1366163877 at webmail.messagingengine.com>
Content-Type: text/plain; charset="us-ascii"

>>Is there a Windows API call I can use to display a BMP or a PNG
>>file in a window centered on a user's display? This function
>>would be called from a console app to display a splash screen.

I don't know, but I suspect not.
>>complexity of a full GUI framework like wxPython or pyQT and
To do this in wxPython is approximately 10 lines of code, maybe 20 at the
most.
Actually- the # of lines to do this in wxPython is less than your original
email.


class SketchApp(wx.App):

    def OnInit(self):
        bmp = wx.Image("splash.png").ConvertToBitmap()
        wx.SplashScreen(bmp, wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
                1000, None, -1)
        wx.Yield()

        frame = SketchFrame(None)
        frame.Show(True)
        self.SetTopWindow(frame)
        return True

if __name__ == '__main__':
    app = SketchApp(False)
    app.MainLoop()


This is barebones, taken from wxPython In Action- ideally you should have
some minimal exception handling
to make your app more robust.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100322/d0bd4502/attachment.html>


More information about the python-win32 mailing list