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

python at bdurham.com python at bdurham.com
Tue Mar 23 00:02:57 CET 2010


Hi Tony,

Thanks for the wxPython code. My reason for wanting to avoid
wxPython (and pyQt) is that I don't want to ship the wxPython
framework just to display a splash screen. I believe this might
triple the size of my PY2EXE generated executables - not a
worthwhile tradeoff for a cosmetic feature like a splash screen.

Regards,
Malcolm

----- Original message -----
From: "Tony Cappellini" <cappy2112 at gmail.com>
To: python-win32 at python.org
Cc: python at bdurham.com
Date: Mon, 22 Mar 2010 15:47:47 -0700
Subject: Re:Win API call to display a BMP/PNG file as a splash
screen for a console app?
From: [1]python at bdurham.com
To: "zz Python Win32 Newsgroup" <[2]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:
<[3]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.

References

1. mailto:python at bdurham.com
2. mailto:python-win32 at python.org
3. mailto:1269295703.32357.1366163877 at webmail.messagingengine.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100322/d2e6a011/attachment.html>


More information about the python-win32 mailing list