Skip to content

Commit

Permalink
use advanced splash for transparency
Browse files Browse the repository at this point in the history
  • Loading branch information
tumregels committed Jan 20, 2021
1 parent 6120e83 commit 9a35f76
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions asciiviewer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from platform import python_version

import wx
import wx.adv
import wx.lib.agw.advancedsplash as AS
from six.moves import configparser

import asciiviewer
Expand Down Expand Up @@ -367,22 +367,22 @@ def OnActivated(self, evt):
self.tree.Toggle(evt.GetItem())


class MySplashScreen(wx.adv.SplashScreen):
class MySplashScreen(AS.AdvancedSplash):
"""
Create a splash screen widget.
"""

def __init__(self, parent, appLauncher):
self.appLauncher = appLauncher
splash_path = os.path.join(application_path, 'assets', 'splash.png')
aBitmap = wx.Bitmap(splash_path)
splashStyle = wx.adv.SPLASH_CENTRE_ON_SCREEN | wx.adv.SPLASH_TIMEOUT
splashDuration = 1000 # milliseconds
# Call the constructor with the above arguments in exactly the
# following order.
wx.adv.SplashScreen.__init__(self, aBitmap, splashStyle, splashDuration, parent)
img = wx.Image(splash_path)
img.ConvertAlphaToMask()
bitmap = wx.Bitmap(img)
splash_duration = 1000 # milliseconds

AS.AdvancedSplash.__init__(self, parent, bitmap=bitmap, timeout=splash_duration)
self.Bind(wx.EVT_CLOSE, self.OnExit)
wx.Yield()
wx.GetApp().Yield()

def OnExit(self, evt):
self.appLauncher()
Expand Down

0 comments on commit 9a35f76

Please sign in to comment.