Skip to content

Conversation

@jonathanrocher
Copy link
Collaborator

@jonathanrocher jonathanrocher commented Jul 7, 2022

Adding a new attribute splash_screen_duration to control the duration for which the splash screen is shown upon application start.

Copy link
Contributor

@corranwebster corranwebster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm guessing what you want, is for the splash screen to persist for at least a minimum amount of time so it is visible to the user.

Probably the right way of doing this is to instead modify start_event_loop to do something like

    def start_event_loop(self):
        if self._splash_screen is not None:
            self.invoke_after(
                self.splash_screen_duration * 1000,  # milliseconds
                self.self._splash_screen.close,
            )
    ...

which avoids locking up the app, and also allows the user to dismiss by clicking on it.

if self.gui is Undefined:
self.gui = GUI(splash_screen=self.splash_screen)
if self.splash_screen_duration > 0:
sleep(self.splash_screen_duration)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This halts all processing for a number of seconds, and in particular the event loop will not be running so the app will be locked-up, which is generally not a good thing. At a minimum, this should occasionally be processing events.

splash_screen = Instance(ISplashScreen)

#: How long to display the splash screen, in seconds. Flashed by default.
splash_screen_duration = Int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a float.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants