gui module¶
GUI package.
(See gui/screens for the graphical interfaces.)
gui.checkbox¶
Module name: checkbox
- class game.gui.checkbox.Checkbox(title: str, x: int = 0, y: int = 0, size: int = 20, checked: bool = False)¶
Bases:
WidgetClass for creating a checkbox.
- MAX_HEIGHT = 0¶
- MAX_WIDTH = 0¶
- MIN_HEIGHT = 0¶
- MIN_WIDTH = 0¶
- can_interact() bool¶
Return whether the widget can be interacted with or not, independent to its visibility.
- center(parent_x: int, parent_y: int, parent_width: int, parent_height: int) Self¶
Center the widget on both axes relative to the specified parent, then return the widget itself.
- center_horizontally(parent_x: int, parent_width: int) Self¶
Center the widget horizontally relative to the specified parent, then return the widget itself.
- center_vertically(parent_y: int, parent_height: int) Self¶
Center the widget vertically relative to the specified parent, then return the widget itself.
- center_with_offset(parent_x: int, parent_y: int, parent_width: int, parent_height: int, x: int, y: int) Self¶
Center the widget with and offset it by x and y relative to the specified parent, then return the widget itself.
- offset(offset_x: int, offset_y: int) Self¶
Add an offset to the x and y positions of the widget, then return the widget itself.
- offset_x(offset_x: int) Self¶
Add an offset to the x position of the widget, then return the widget itself.
- offset_y(offset_y: int) Self¶
Add an offset to the y position of the widget, then return the widget itself.
- set_checked(state: bool) Self¶
Set the checked state of the checkbox’s button, then return the checkbox itself.
- set_interact(state: bool) Self¶
Set whether the widget is interactable or not, independent to its visibility, then return the widget itself.
- set_state(state: bool) Self¶
Set the widget’s visibility and interactivity state, then return the widget itself.
gui.horizontal_slider¶
Module name: horizontal_slider
- class game.gui.horizontal_slider.HorizontalSlider(title: str = '', x: int = 0, y: int = 0, width: int = 350)¶
Bases:
WidgetClass for creating a horizontal slider.
- MAX_HEIGHT = 0¶
- MAX_WIDTH = 0¶
- MIN_HEIGHT = 0¶
- MIN_WIDTH = 0¶
- button_held(state: bool) Self¶
Set whether the horizontal slider’s button is held or not, then return the horizontal slider itself.
- can_interact() bool¶
Return whether the widget can be interacted with or not, independent to its visibility.
- center(parent_x: int, parent_y: int, parent_width: int, parent_height: int) Self¶
Center the widget on both axes relative to the specified parent, then return the widget itself.
- center_horizontally(parent_x: int, parent_width: int) Self¶
Center the widget horizontally relative to the specified parent, then return the widget itself.
- center_vertically(parent_y: int, parent_height: int) Self¶
Center the widget vertically relative to the specified parent, then return the widget itself.
- center_with_offset(parent_x: int, parent_y: int, parent_width: int, parent_height: int, x: int, y: int) Self¶
Center the widget with and offset it by x and y relative to the specified parent, then return the widget itself.
- get_step_in_pixels() float¶
Return the number of pixels needed to move the horizontal slider’s button from one value to the next.
- get_value_bounds() tuple[int, int]¶
Return the value bounds of the horizontal slider (min/max value).
- is_hovering_over_button() bool¶
Return whether the user’s mouse cursor is hovering over the horizontal slider’s button or not.
- offset(offset_x: int, offset_y: int) Self¶
Add an offset to the x and y positions of the widget, then return the widget itself.
- offset_x(offset_x: int) Self¶
Add an offset to the x position of the widget, then return the widget itself.
- offset_y(offset_y: int) Self¶
Add an offset to the y position of the widget, then return the widget itself.
- set_interact(state: bool) Self¶
Set whether the widget is interactable or not, independent to its visibility, then return the widget itself.
- set_state(state: bool) Self¶
Set the widget’s visibility and interactivity state, then return the widget itself.
- set_title(title: str) Self¶
Set the title’s text of the horizontal slider, then return the horizontal slider itself.
- set_transparency(transparency: float) Self¶
Set the widget’s transparency, then return the widget itself.
- set_value(value: int) Self¶
Set the value of the horizontal slider, then return the horizontal slider itself.
- set_value_bounds(min_value: int | None = None, max_value: int | None = None) Self¶
Set the value bounds of the horizontal slider (min/max value), then return the horizontal slider itself.
gui.hotbar¶
Module name: hotbar
- class game.gui.hotbar.Hotbar(x: int = 0, y: int = 0, slot_count: int = 4)¶
Bases:
WidgetClass for creating a hotbar.
- MAX_HEIGHT = 0¶
- MAX_WIDTH = 0¶
- MIN_HEIGHT = 0¶
- MIN_WIDTH = 0¶
- can_interact() bool¶
Return whether the widget can be interacted with or not, independent to its visibility.
- center(parent_x: int, parent_y: int, parent_width: int, parent_height: int) Self¶
Center the widget on both axes relative to the specified parent, then return the widget itself.
- center_horizontally(parent_x: int, parent_width: int) Self¶
Center the widget horizontally relative to the specified parent, then return the widget itself.
- center_vertically(parent_y: int, parent_height: int) Self¶
Center the widget vertically relative to the specified parent, then return the widget itself.
- center_with_offset(parent_x: int, parent_y: int, parent_width: int, parent_height: int, x: int, y: int) Self¶
Center the widget with and offset it by x and y relative to the specified parent, then return the widget itself.
- get_atlas() pygame.Surface¶
Return the texture atlas used by the hotbar.
- offset(offset_x: int, offset_y: int) Self¶
Add an offset to the x and y positions of the widget, then return the widget itself.
- offset_x(offset_x: int) Self¶
Add an offset to the x position of the widget, then return the widget itself.
- offset_y(offset_y: int) Self¶
Add an offset to the y position of the widget, then return the widget itself.
- set_atlas(atlas: pygame.Surface) Self¶
Set the texture atlas that will be used by the hotbar, then return the hotbar itself.
- set_interact(state: bool) Self¶
Set whether the widget is interactable or not, independent to its visibility, then return the widget itself.
- set_spacing(spacing: int) Self¶
Set the spacing between the hotbar’s slots, then return the hotbar itself.
- set_state(state: bool) Self¶
Set the widget’s visibility and interactivity state, then return the widget itself.
gui.inputbox¶
Module name: inputbox
- class game.gui.inputbox.InputBox(text: str = '', placeholder_text: str = '', tooltip_text: str = '', x: int = 0, y: int = 0, width: int = 800, height: int = 50)¶
Bases:
WidgetClass for creating an input box.
- MAX_HEIGHT = 0¶
- MAX_WIDTH = 0¶
- MIN_HEIGHT = 0¶
- MIN_WIDTH = 0¶
- authorise_only_alnum() Self¶
Authorise only alphanumerical values (a-zA-Z0-9), then return the input box itself.
- authorise_only_alnumdot() Self¶
Authorise only alphanumerical values (a-zA-Z0-9.), then return the input box itself. This includes the dot (period/full stop) character.
- authorise_only_alnumlines() Self¶
Authorise only alphanumerical values (a-zA-Z0-9-_), then return the input box itself. This includes dashes (hyphens) and underscores.
- authorise_only_ascii() Self¶
Authorise only ASCII characters in the input box, then return the input box itself.
- authorise_only_numeric() Self¶
Authorise only numerical values (0-9) in the input box, then return the input box itself.
- can_interact() bool¶
Return whether the widget can be interacted with or not, independent to its visibility.
- center(parent_x: int, parent_y: int, parent_width: int, parent_height: int) Self¶
Center the widget on both axes relative to the specified parent, then return the widget itself.
- center_horizontally(parent_x: int, parent_width: int) Self¶
Center the widget horizontally relative to the specified parent, then return the widget itself.
- center_vertically(parent_y: int, parent_height: int) Self¶
Center the widget vertically relative to the specified parent, then return the widget itself.
- center_with_offset(parent_x: int, parent_y: int, parent_width: int, parent_height: int, x: int, y: int) Self¶
Center the widget with and offset it by x and y relative to the specified parent, then return the widget itself.
- offset(offset_x: int, offset_y: int) Self¶
Add an offset to the x and y positions of the widget, then return the widget itself.
- offset_x(offset_x: int) Self¶
Add an offset to the x position of the widget, then return the widget itself.
- offset_y(offset_y: int) Self¶
Add an offset to the y position of the widget, then return the widget itself.
- scroll_text() None¶
Internal method for calculating how and when to scroll text when going beyond the input box. I am aware of how awful it is. Why? because O(n). What does that mean? the larger the text, the slower it gets! Very bad! Might not be that noticeable for small strings, but still… TODO: Make it better, fool.
- set_background_colour(background_colour: tuple[int, int, int]) Self¶
Set the background colour of the input box, then return the input box itself.
- set_border_colour(border_colour: tuple[int, int, int]) Self¶
Set the border colour of the input box, then return the input box itself.
- set_cursor_colour(cursor_colour: tuple[int, int, int]) Self¶
Set the cursor colour of the input box, then return the input box itself.
- set_interact(state: bool) Self¶
Set whether the widget is interactable or not, independent to its visibility, then return the widget itself.
- set_max_text_length(max_text_length: int) Self¶
Set the input box’s max text length, then return the input box itself.
- set_placeholder_text(placeholder_text: str) Self¶
Set the placeholder label text of the input box, then return the input box itself.
- set_placeholder_text_colour(placeholder_text_colour: tuple[int, int, int]) Self¶
Set the placeholder text colour, then return the input box itself.
- set_read_only(state: bool) Self¶
Set the input box’s read-only state, then return the input box itself.
- set_selected(state) Self¶
Set the selected state of the input box, then return the input box itself.
- set_state(state: bool) Self¶
Set the widget’s visibility and interactivity state, then return the widget itself.
- set_text_colour(text_colour: tuple[int, int, int]) Self¶
Set the text colour, then return the input box itself.
- set_tooltip_text(tooltip_text: str) Self¶
Set the input box’s tooltip text, then return the input box itself.
gui.label¶
Module name: label
- class game.gui.label.Label(text: str = '', x: int = 0, y: int = 0)¶
Bases:
WidgetClass for creating a label.
- DEFAULT_FONT = '/home/docs/checkouts/readthedocs.org/user_builds/tile-game/checkouts/latest/game/assets/font.ttf'¶
- DEFAULT_FONT_SIZE_LARGE = 13¶
- DEFAULT_FONT_SIZE_NORMAL = 11¶
- DEFAULT_FONT_SIZE_SMALL = 8¶
- MAX_HEIGHT = 0¶
- MAX_WIDTH = 0¶
- MIN_HEIGHT = 0¶
- MIN_WIDTH = 0¶
- can_interact() bool¶
Return whether the widget can be interacted with or not, independent to its visibility.
- center(parent_x: int, parent_y: int, parent_width: int, parent_height: int) Self¶
Center the widget on both axes relative to the specified parent, then return the widget itself.
- center_horizontally(parent_x: int, parent_width: int) Self¶
Center the widget horizontally relative to the specified parent, then return the widget itself.
- center_vertically(parent_y: int, parent_height: int) Self¶
Center the widget vertically relative to the specified parent, then return the widget itself.
- center_with_offset(parent_x: int, parent_y: int, parent_width: int, parent_height: int, x: int, y: int) Self¶
Center the widget with and offset it by x and y relative to the specified parent, then return the widget itself.
- get_font_sizes() tuple[int, int, int]¶
Return the small, medium and large sizes of the label’s text.
- offset(offset_x: int, offset_y: int) Self¶
Add an offset to the x and y positions of the widget, then return the widget itself.
- offset_x(offset_x: int) Self¶
Add an offset to the x position of the widget, then return the widget itself.
- offset_y(offset_y: int) Self¶
Add an offset to the y position of the widget, then return the widget itself.
- set_antialiasing(state: bool) Self¶
Set the antialiasing state of the label, then return the label itself.
- set_auto_font_size(width: int, height: int, max_width: int, max_height: int) Self¶
Set the automatic font size of the label, then return the label itself.
- set_colour(colour: tuple[int, int, int]) Self¶
Set the label’s text colour, then return the label itself.
- set_font_sizes(font_sizes: tuple[int, int, int]) Self¶
Set the small, medium and large sizes of the label’s text, then return the label itself.
- set_interact(state: bool) Self¶
Set whether the widget is interactable or not, independent to its visibility, then return the widget itself.
- set_shadow_colour(shadow_colour) Self¶
Set the label’s text shadow colour, then return the label itself.
- set_shadow_x_offset(offset) Self¶
Set the x offset of the label’s shadow, then return the label itself.
- set_shadow_y_offset(offset) Self¶
Set the y offset of the label’s shadow, then return the label itself.
- set_state(state: bool) Self¶
Set the widget’s visibility and interactivity state, then return the widget itself.
gui.nametag¶
Module name: nametag
- class game.gui.nametag.NameTag(text: str = '', x: int = 0, y: int = 0)¶
Bases:
WidgetClass for creating a nametag.
- MAX_HEIGHT = 0¶
- MAX_WIDTH = 0¶
- MIN_HEIGHT = 0¶
- MIN_WIDTH = 0¶
- can_interact() bool¶
Return whether the widget can be interacted with or not, independent to its visibility.
- center(parent_x: int, parent_y: int, parent_width: int, parent_height: int) Self¶
Center the widget on both axes relative to the specified parent, then return the widget itself.
- center_horizontally(parent_x: int, parent_width: int) Self¶
Center the widget horizontally relative to the specified parent, then return the widget itself.
- center_vertically(parent_y: int, parent_height: int) Self¶
Center the widget vertically relative to the specified parent, then return the widget itself.
- center_with_offset(parent_x: int, parent_y: int, parent_width: int, parent_height: int, x: int, y: int) Self¶
Center the widget with and offset it by x and y relative to the specified parent, then return the widget itself.
- offset(offset_x: int, offset_y: int) Self¶
Add an offset to the x and y positions of the widget, then return the widget itself.
- offset_x(offset_x: int) Self¶
Add an offset to the x position of the widget, then return the widget itself.
- offset_y(offset_y: int) Self¶
Add an offset to the y position of the widget, then return the widget itself.
- set_background_colour(background_colour: tuple[int, int, int]) Self¶
Set the background colour of the nametag, then return the nametag itself.
- set_interact(state: bool) Self¶
Set whether the widget is interactable or not, independent to its visibility, then return the widget itself.
- set_state(state: bool) Self¶
Set the widget’s visibility and interactivity state, then return the widget itself.
gui.ordering_container¶
Module name: ordering_container
- class game.gui.ordering_container.OrderingContainer¶
Bases:
WidgetClass for creating an ordering container. This is used for containing widgets that require ordering, like for tabbing between widgets. This isn’t a visible GUI component.
- MAX_HEIGHT = 0¶
- MAX_WIDTH = 0¶
- MIN_HEIGHT = 0¶
- MIN_WIDTH = 0¶
- can_interact() bool¶
Return whether the widget can be interacted with or not, independent to its visibility.
- center(parent_x: int, parent_y: int, parent_width: int, parent_height: int) Self¶
Center the widget on both axes relative to the specified parent, then return the widget itself.
- center_horizontally(parent_x: int, parent_width: int) Self¶
Center the widget horizontally relative to the specified parent, then return the widget itself.
- center_vertically(parent_y: int, parent_height: int) Self¶
Center the widget vertically relative to the specified parent, then return the widget itself.
- center_with_offset(parent_x: int, parent_y: int, parent_width: int, parent_height: int, x: int, y: int) Self¶
Center the widget with and offset it by x and y relative to the specified parent, then return the widget itself.
- offset(offset_x: int, offset_y: int) Self¶
Add an offset to the x and y positions of the widget, then return the widget itself.
- offset_x(offset_x: int) Self¶
Add an offset to the x position of the widget, then return the widget itself.
- offset_y(offset_y: int) Self¶
Add an offset to the y position of the widget, then return the widget itself.
- set_interact(state: bool) Self¶
Set whether the widget is interactable or not, independent to its visibility, then return the widget itself.
- set_state(state: bool) Self¶
Set the widget’s visibility and interactivity state, then return the widget itself.
- set_transparency(transparency: float) Self¶
Set the widget’s transparency, then return the widget itself.
gui.progress_bar¶
Module name: progress_bar
- class game.gui.progress_bar.ProgressBar(title: str = '', x: int = 0, y: int = 0, width: int = 800, height: int = 30, value: int = 0, min_value: int = 0, max_value: int = 100)¶
Bases:
WidgetClass for creating a progress bar
- MAX_HEIGHT = 0¶
- MAX_WIDTH = 0¶
- MIN_HEIGHT = 0¶
- MIN_WIDTH = 0¶
- can_interact() bool¶
Return whether the widget can be interacted with or not, independent to its visibility.
- center(parent_x: int, parent_y: int, parent_width: int, parent_height: int) Self¶
Center the widget on both axes relative to the specified parent, then return the widget itself.
- center_horizontally(parent_x: int, parent_width: int) Self¶
Center the widget horizontally relative to the specified parent, then return the widget itself.
- center_vertically(parent_y: int, parent_height: int) Self¶
Center the widget vertically relative to the specified parent, then return the widget itself.
- center_with_offset(parent_x: int, parent_y: int, parent_width: int, parent_height: int, x: int, y: int) Self¶
Center the widget with and offset it by x and y relative to the specified parent, then return the widget itself.
- offset(offset_x: int, offset_y: int) Self¶
Add an offset to the x and y positions of the widget, then return the widget itself.
- offset_x(offset_x: int) Self¶
Add an offset to the x position of the widget, then return the widget itself.
- offset_y(offset_y: int) Self¶
Add an offset to the y position of the widget, then return the widget itself.
- set_filled_end_colour(filled_end_colour: tuple[int, int, int]) Self¶
Set the filled end colour of the progress bar, then return the progress bar itself.
- set_filled_start_colour(filled_start_colour: tuple[int, int, int]) Self¶
Set the filled start colour of the progress bar, then return the progress bar itself.
- set_interact(state: bool) Self¶
Set whether the widget is interactable or not, independent to its visibility, then return the widget itself.
- set_state(state: bool) Self¶
Set the widget’s visibility and interactivity state, then return the widget itself.
- set_title(title: str) Self¶
Set the title text of the progress bar, then return the progress bar itself.
- set_transparency(transparency: float) Self¶
Set the widget’s transparency, then return the widget itself.
- set_unfilled_colour(unfilled_colour: tuple[int, int, int]) Self¶
Set the unfilled colour of the progress bar, then return the progress bar itself.
gui.screen_manager¶
Module name: screen_manager
This module manages all the GUIs, their visibility and their behaviour.
gui.screens¶
Screens package.
It holds all the different graphical user interfaces (or screens if you prefer something shorter but longer than the acronym ‘GUI’ (pronounced /ˈɡuː.i/ by the way)).
gui.screens.crash_screen¶
Module name: crash_screen
gui.screens.credits_screen¶
Module name: credits_screen
gui.screens.fx_screen¶
Module name: fx_screen
- class game.gui.screens.fx_screen.FxScreen(game: Game)¶
Bases:
ScreenClass for creating an effect layer screen.
- static draw_falling_snow_layer(screen: pygame.Surface)¶
Draw falling snow layer to screen.
gui.screens.gameover_screen¶
Module name: gameover_screen
gui.screens.loading_screen¶
Module name: loading_screen
gui.screens.main_hud¶
Module name: main_hud
gui.screens.map_screen¶
Module name: map_screen
gui.screens.options_screen¶
Module name: options_screen
gui.screens.pause_screen¶
Module name: pause_screen
gui.screens.playerlist_screen¶
Module name: playerlist_screen
gui.screens.screen¶
Module name: screen
This module defines the base class for all graphical user interfaces.
gui.screens.serverconnect_screen¶
Module name: serverconnect_screen
- class game.gui.screens.serverconnect_screen.ServerConnectScreen(game: Game)¶
Bases:
ScreenClass for creating the server connection screen.
- reset_info_label() None¶
Reset the information label back to its default state, then update the screen UI.
- set_state(state: bool) None¶
Set the screen’s visibility and interactivity state, then return the screen itself
gui.screens.servercreate_screen¶
Module name: servercreate_screen
gui.screens.serverjoin_screen¶
Module name: serverjoin_screen
gui.selectbox¶
Module name: select_list
- class game.gui.selectbox.SelectBox(x: int = 0, y: int = 0, width: int = 800, height: int = 50, tooltip_text: str = '')¶
Bases:
WidgetClass for creating a select box.
- ARROW_X_OFFSET = 10¶
- MAX_ARROW_WIDTH = 15¶
- MAX_HEIGHT = 0¶
- MAX_VALUE_HEIGHT = 50¶
- MAX_VISIBLE_VALUES = 3¶
- MAX_WIDTH = 0¶
- MIN_ARROW_WIDTH = 4¶
- MIN_HEIGHT = 0¶
- MIN_VALUE_HEIGHT = 10¶
- MIN_WIDTH = 0¶
- can_interact() bool¶
Return whether the widget can be interacted with or not, independent to its visibility.
- center(parent_x: int, parent_y: int, parent_width: int, parent_height: int) Self¶
Center the widget on both axes relative to the specified parent, then return the widget itself.
- center_horizontally(parent_x: int, parent_width: int) Self¶
Center the widget horizontally relative to the specified parent, then return the widget itself.
- center_vertically(parent_y: int, parent_height: int) Self¶
Center the widget vertically relative to the specified parent, then return the widget itself.
- center_with_offset(parent_x: int, parent_y: int, parent_width: int, parent_height: int, x: int, y: int) Self¶
Center the widget with and offset it by x and y relative to the specified parent, then return the widget itself.
- draw_value_list(window: Window) None¶
Draw the select box’s value list and its components. This is used independently to the draw method, to handle the rendering priority independent to the actual select box rendering priority.
- is_hovering_over_display_box()¶
Return whether the user’s mouse cursor is hovering over the select box’s display box.
- is_hovering_over_value(index: int)¶
Return whether the user’s mouse cursor is hovering over the provided select box value by index.
- is_hovering_over_value_list()¶
Return whether the user’s mouse cursor is hovering over the select box’s value list.
- offset(offset_x: int, offset_y: int) Self¶
Add an offset to the x and y positions of the widget, then return the widget itself.
- offset_x(offset_x: int) Self¶
Add an offset to the x position of the widget, then return the widget itself.
- offset_y(offset_y: int) Self¶
Add an offset to the y position of the widget, then return the widget itself.
- set_current_index(index: int) Self¶
Set the select box’s current index, then return the select box itself.
- set_interact(state: bool) Self¶
Set whether the widget is interactable or not, independent to its visibility, then return the widget itself.
- set_open(state: bool) Self¶
Set the open state of the select box (visibility of the select box’s value list), then return the select box itself.
- set_state(state: bool) Self¶
Set the widget’s visibility and interactivity state, then return the widget itself.
- set_tooltip_text(tooltip_text: str) Self¶
Set the display box’s tooltip text, then return the select box itself.
gui.slot¶
Module name: slot
- class game.gui.slot.Slot(x: int = 0, y: int = 0, size: int = 64)¶
Bases:
WidgetClass for creating a slot.
- MAX_HEIGHT = 0¶
- MAX_WIDTH = 0¶
- MIN_HEIGHT = 0¶
- MIN_WIDTH = 0¶
- can_interact() bool¶
Return whether the widget can be interacted with or not, independent to its visibility.
- center(parent_x: int, parent_y: int, parent_width: int, parent_height: int) Self¶
Center the widget on both axes relative to the specified parent, then return the widget itself.
- center_horizontally(parent_x: int, parent_width: int) Self¶
Center the widget horizontally relative to the specified parent, then return the widget itself.
- center_vertically(parent_y: int, parent_height: int) Self¶
Center the widget vertically relative to the specified parent, then return the widget itself.
- center_with_offset(parent_x: int, parent_y: int, parent_width: int, parent_height: int, x: int, y: int) Self¶
Center the widget with and offset it by x and y relative to the specified parent, then return the widget itself.
- get_item_asset() pygame.Surface¶
Return the item asset of the slot.
- offset(offset_x: int, offset_y: int) Self¶
Add an offset to the x and y positions of the widget, then return the widget itself.
- offset_x(offset_x: int) Self¶
Add an offset to the x position of the widget, then return the widget itself.
- offset_y(offset_y: int) Self¶
Add an offset to the y position of the widget, then return the widget itself.
- set_inner_colour(inner_colour: tuple[int, int, int]) Self¶
Set the inner colour of the slot, then return the slot itself.
- set_inner_width(inner_width: int) Self¶
Set the inner width of the slot, then return the slot itself.
- set_interact(state: bool) Self¶
Set whether the widget is interactable or not, independent to its visibility, then return the widget itself.
- set_outline_colour(outline_colour: tuple[int, int, int]) Self¶
Set the outline colour of the slot, then return the slot itself.
- set_state(state: bool) Self¶
Set the widget’s visibility and interactivity state, then return the widget itself.
gui.tooltip¶
Module name: tooltip
- class game.gui.tooltip.Tooltip(x: int = 0, y: int = 0, text: str = '')¶
Bases:
WidgetClass for creating a tooltip.
- MAX_HEIGHT = 0¶
- MAX_WIDTH = 0¶
- MIN_HEIGHT = 0¶
- MIN_WIDTH = 0¶
- can_interact() bool¶
Return whether the widget can be interacted with or not, independent to its visibility.
- center(parent_x: int, parent_y: int, parent_width: int, parent_height: int) Self¶
Center the widget on both axes relative to the specified parent, then return the widget itself.
- center_horizontally(parent_x: int, parent_width: int) Self¶
Center the widget horizontally relative to the specified parent, then return the widget itself.
- center_vertically(parent_y: int, parent_height: int) Self¶
Center the widget vertically relative to the specified parent, then return the widget itself.
- center_with_offset(parent_x: int, parent_y: int, parent_width: int, parent_height: int, x: int, y: int) Self¶
Center the widget with and offset it by x and y relative to the specified parent, then return the widget itself.
- initialise_surface() pygame.Surface¶
Initialise the tooltip’s surface.
- offset(offset_x: int, offset_y: int) Self¶
Add an offset to the x and y positions of the widget, then return the widget itself.
- offset_x(offset_x: int) Self¶
Add an offset to the x position of the widget, then return the widget itself.
- offset_y(offset_y: int) Self¶
Add an offset to the y position of the widget, then return the widget itself.
- set_interact(state: bool) Self¶
Set whether the widget is interactable or not, independent to its visibility, then return the widget itself.
- set_state(state: bool) Self¶
Set the widget’s visibility and interactivity state, then return the widget itself.
gui.widget¶
Module name: widget
This module defines the base class for all GUI widgets.
- class game.gui.widget.Widget(x: int, y: int, width: int = 0, height: int = 0)¶
Bases:
objectClass for creating a widget.
- MAX_HEIGHT = 0¶
- MAX_WIDTH = 0¶
- MIN_HEIGHT = 0¶
- MIN_WIDTH = 0¶
- can_interact() bool¶
Return whether the widget can be interacted with or not, independent to its visibility.
- center(parent_x: int, parent_y: int, parent_width: int, parent_height: int) Self¶
Center the widget on both axes relative to the specified parent, then return the widget itself.
- center_horizontally(parent_x: int, parent_width: int) Self¶
Center the widget horizontally relative to the specified parent, then return the widget itself.
- center_vertically(parent_y: int, parent_height: int) Self¶
Center the widget vertically relative to the specified parent, then return the widget itself.
- center_with_offset(parent_x: int, parent_y: int, parent_width: int, parent_height: int, x: int, y: int) Self¶
Center the widget with and offset it by x and y relative to the specified parent, then return the widget itself.
- offset(offset_x: int, offset_y: int) Self¶
Add an offset to the x and y positions of the widget, then return the widget itself.
- offset_x(offset_x: int) Self¶
Add an offset to the x position of the widget, then return the widget itself.
- offset_y(offset_y: int) Self¶
Add an offset to the y position of the widget, then return the widget itself.
- set_interact(state: bool) Self¶
Set whether the widget is interactable or not, independent to its visibility, then return the widget itself.
- set_state(state: bool) Self¶
Set the widget’s visibility and interactivity state, then return the widget itself.