Module albow.core.ui.Screen
Source code
from pygame.event import Event
from albow.core.ui.Shell import Shell
from albow.core.ui.Widget import Widget
class Screen(Widget):
"""
Screen is an abstract base class for widgets to be uses as screens by a Shell.
"""
def __init__(self, shell: Shell, **kwds):
"""
Constructs a Screen associated with the given shell.
Args:
shell: The shell to associate with
**kwds:
"""
#
# Python 3 update
super().__init__(shell.rect, **kwds)
self.shell = shell
self.center = shell.center
def begin_frame(self):
"""Deprecated, use timer_event() instead."""
pass
#
# Abstract methods follow
#
def timer_event(self, event: Event):
"""
Called from the timer_event() method of the Shell when this screen is the current screen. The default
implementation returns true so that a display update is performed.
Args:
event:
"""
self.begin_frame()
return True
def enter_screen(self):
"""
Called from the Shell after switching to this screen from another screen.
"""
pass
def leave_screen(self):
"""
Called from the Shell before switching away from this screen to another screen.
"""
pass
Classes
class Screen (shell, **kwds)
-
Screen is an abstract base class for widgets to be uses as screens by a Shell.
Constructs a Screen associated with the given shell.
Args
shell
- The shell to associate with
**kwds:
Source code
class Screen(Widget): """ Screen is an abstract base class for widgets to be uses as screens by a Shell. """ def __init__(self, shell: Shell, **kwds): """ Constructs a Screen associated with the given shell. Args: shell: The shell to associate with **kwds: """ # # Python 3 update super().__init__(shell.rect, **kwds) self.shell = shell self.center = shell.center def begin_frame(self): """Deprecated, use timer_event() instead.""" pass # # Abstract methods follow # def timer_event(self, event: Event): """ Called from the timer_event() method of the Shell when this screen is the current screen. The default implementation returns true so that a display update is performed. Args: event: """ self.begin_frame() return True def enter_screen(self): """ Called from the Shell after switching to this screen from another screen. """ pass def leave_screen(self): """ Called from the Shell before switching away from this screen to another screen. """ pass
Ancestors
Subclasses
- albow.demo.screens.BaseDemoScreen.BaseDemoScreen
- albow.demo.screens.GridDebugScreen.GridDebugScreen
- albow.demo.screens.LaunchDemosScreen.LaunchDemosScreen
- albow.demo.AlbowDemoScreen.AlbowDemoScreen
- TextScreen
Methods
def begin_frame(self)
-
Deprecated, use timer_event() instead.
Source code
def begin_frame(self): """Deprecated, use timer_event() instead.""" pass
def enter_screen(self)
-
Called from the Shell after switching to this screen from another screen.
Source code
def enter_screen(self): """ Called from the Shell after switching to this screen from another screen. """ pass
def leave_screen(self)
-
Called from the Shell before switching away from this screen to another screen.
Source code
def leave_screen(self): """ Called from the Shell before switching away from this screen to another screen. """ pass
def timer_event(self, event)
-
Called from the timer_event() method of the Shell when this screen is the current screen. The default implementation returns true so that a display update is performed.
Args
event:
Source code
def timer_event(self, event: Event): """ Called from the timer_event() method of the Shell when this screen is the current screen. The default implementation returns true so that a display update is performed. Args: event: """ self.begin_frame() return True
Inherited members
Widget
:add
add_anchor
add_centered
anchor
attention_lost
augment_mouse_event
bg_color
bg_image
border_color
border_width
call_handler
call_parent_handler
defer_drawing
dismiss
draw
draw_over
fg_color
focus
focus_switch
font
get_cursor
get_focus
get_margin_rect
get_root
get_top_widget
get_visible
global_to_local
has_focus
inherited
invalidate
is_gl_container
key_down
key_up
local_to_global
margin
menu_bar
parent
parent_resized
present
rect
relative_mode
remove
remove_anchor
resized
scale_bg
sel_color
set_parent
set_size_for_text
tab_stop
visible