class shell.Shell(RootWidget)
The Shell class is an abstract class to use as a base for the outer
shell of a game. It provides facilities for switching between a number
of screens, such as menus, pages of instructions or the game itself.
Any widget can be used as a screen, although you may wish to use the TextScreen widget for displaying pages of text.
Constructor
- Shell(surface)
- Initializes the Shell with the given surface as its root surface (normally this will be the PyGame screen surface).
Attributes
- current_screen
- Read-only. The widget being displayed as the current screen. Use the show_screen() method to change this.
Methods
- show_screen(widget)
- Hides the previous screen, if any, and shows the given widget as
the new screen. The widget is displayed centered within the shell.
Abstract Methods
- show_menu()
- If you are using the TextScreen widget, you will need to
implement this method. It should switch to whichever screen you're
using for the game's main menu. It will be called when a TextScreen is
being displayed and the user presses the Back button on that screen.
---