-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathSplash.py
More file actions
47 lines (38 loc) · 1.57 KB
/
Splash.py
File metadata and controls
47 lines (38 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import wx
from wx.adv import SplashScreen as SplashScreen
class MySplashScreen(SplashScreen):
"""
Create a splash screen widget.
"""
def __init__(self, parent=None):
#------------
# This is a recipe to a the screen.
# Modify the following variables as necessary.
bitmap = wx.Bitmap(name="Splash.png", type=wx.BITMAP_TYPE_PNG)
splash = wx.adv.SPLASH_CENTRE_ON_SCREEN | wx.adv.SPLASH_TIMEOUT
duration = 3000 # milliseconds
# Call the constructor with the above arguments
# in exactly the following order.
super(MySplashScreen, self).__init__(bitmap=bitmap,
splashStyle=splash,
milliseconds=duration,
parent=None,
id=-1,
pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=wx.STAY_ON_TOP |
wx.BORDER_NONE)
self.Bind(wx.EVT_CLOSE, self.OnExit)
#-----------------------------------------------------------------------
def OnExit(self, event):
"""
...
"""
# The program will freeze without this line.
event.Skip() # Make sure the default handler runs too...
self.Hide()
app = wx.App()
MySplash = MySplashScreen()
MySplash.CenterOnScreen(wx.BOTH)
MySplash.Show(True)
app.MainLoop()