UiConfig
- class pygamelib.gfx.ui.UiConfig(game=None, box_vertical_border='│', box_horizontal_border='─', box_top_left_corner='╭', box_top_right_corner='╮', box_bottom_left_corner='╰', box_bottom_right_corner='╯', box_vertical_and_right='├', box_vertical_and_left='┤', fg_color: Color = Color(255, 255, 255), bg_color: Color = Color(0, 128, 128), fg_color_inactive: Color = Color(128, 128, 128), bg_color_selected: Color = Color(128, 128, 128), bg_color_not_selected=None, fg_color_selected: Color = Color(0, 255, 0), fg_color_not_selected: Color = Color(255, 255, 255), bg_color_menu_not_selected: Color = Color(128, 128, 128), border_fg_color: Color = Color(255, 255, 255), border_bg_color: Color = None, borderless_dialog: bool = True, widget_bg_color: Color = Color(0, 128, 128), input_fg_color: Color = Color(255, 255, 255), input_bg_color: Color = Color(163, 163, 163))
Bases:
object
A configuration object for the UI module. TEST
This object’s purpose is to configure the look and feel of the UI widgets. It does nothing by itself.
- Parameters:
game (
Game
) – The game object.box_vertical_border (str) – The vertical border of a box.
box_horizontal_border (str) – The horizontal border of a box.
box_top_left_corner (str) – The top left corner of a box.
box_top_right_corner (str) – The top right corner of a box.
box_bottom_left_corner (str) – The bottom left corner of a box.
box_bottom_right_corner (str) – The bottom right corner of a box.
box_vertical_and_right (str) – The left junction between two boxes.
box_vertical_and_left (str) – The right junction between two boxes.
fg_color (
Color
) – The foreground color (for text and content).bg_color (
Color
) – The background color (for text and content).fg_color_inactive (
Color
) – The foreground color for inactive items like menu entries.bg_color_selected (
Color
) – The background color (for selected text and content).bg_color_not_selected (
Color
) – The background color (for non selected text and content).fg_color_selected (
Color
) – The foreground color (for selected text and content).fg_color_not_selected (
Color
) – The foreground color (for non selected text and content).bg_color_menu_not_selected (
Color
) – The menu background color (for expanded menu items).border_fg_color (
Color
) – The foreground color (for borders).border_bg_color (
Color
) – The background color (for borders).borderless_dialog (bool) – Is the dialog borderless or not.
widget_bg_color (
Color
) – The background color of a widget.input_fg_color (
Color
) – The foreground color (i.e the text color) of a LineInput widget.input_bg_color (
Color
) – The background color of a LineInput widget.
Example:
config_ui_red = UiConfig( fg_color=Color(255,0,0), border_fg_color=Color(255,0,0) )
- __init__(game=None, box_vertical_border='│', box_horizontal_border='─', box_top_left_corner='╭', box_top_right_corner='╮', box_bottom_left_corner='╰', box_bottom_right_corner='╯', box_vertical_and_right='├', box_vertical_and_left='┤', fg_color: Color = Color(255, 255, 255), bg_color: Color = Color(0, 128, 128), fg_color_inactive: Color = Color(128, 128, 128), bg_color_selected: Color = Color(128, 128, 128), bg_color_not_selected=None, fg_color_selected: Color = Color(0, 255, 0), fg_color_not_selected: Color = Color(255, 255, 255), bg_color_menu_not_selected: Color = Color(128, 128, 128), border_fg_color: Color = Color(255, 255, 255), border_bg_color: Color = None, borderless_dialog: bool = True, widget_bg_color: Color = Color(0, 128, 128), input_fg_color: Color = Color(255, 255, 255), input_bg_color: Color = Color(163, 163, 163))
Methods
__init__
([game, box_vertical_border, ...])instance
(*args, **kwargs)Returns the instance of the UiConfig object
- classmethod instance(*args, **kwargs)
Returns the instance of the UiConfig object
Creates an UiConfig object on first call an then returns the same instance on further calls. Useful for a default configuration. It accepts all the parameters from the constructor.
- Returns:
Instance of UiConfig object