pygame_gui package
Subpackages
- pygame_gui.core package
- Subpackages
- pygame_gui.core.drawable_shapes package
- Submodules
- pygame_gui.core.drawable_shapes.drawable_shape module
DrawableShapeDrawableShape.align_all_text_rows()DrawableShape.apply_active_text_changes()DrawableShape.build_text_layout()DrawableShape.clean_up_temp_shapes()DrawableShape.collide_point()DrawableShape.finalise_images_and_text()DrawableShape.finalise_text()DrawableShape.finalise_text_onto_active_state()DrawableShape.full_rebuild_on_size_change()DrawableShape.get_active_state_surface()DrawableShape.get_fresh_surface()DrawableShape.get_surface()DrawableShape.has_fresh_surface()DrawableShape.insert_text()DrawableShape.redraw_active_state_no_text()DrawableShape.redraw_all_states()DrawableShape.redraw_state()DrawableShape.set_active_state()DrawableShape.set_dimensions()DrawableShape.set_position()DrawableShape.set_text()DrawableShape.set_text_alpha()DrawableShape.toggle_text_cursor()DrawableShape.update()
DrawableShapeStateDrawableStateTransition
- pygame_gui.core.drawable_shapes.ellipse_drawable_shape module
- pygame_gui.core.drawable_shapes.rect_drawable_shape module
- pygame_gui.core.drawable_shapes.rounded_rect_drawable_shape module
RoundedRectangleShapeRoundedRectangleShape.clean_up_temp_shapes()RoundedRectangleShape.clear_and_create_shape_surface()RoundedRectangleShape.collide_point()RoundedRectangleShape.create_subtract_surface()RoundedRectangleShape.draw_colourless_rounded_rectangle()RoundedRectangleShape.full_rebuild_on_size_change()RoundedRectangleShape.redraw_state()RoundedRectangleShape.set_dimensions()RoundedRectangleShape.set_position()
- Module contents
DrawableShapeDrawableShape.align_all_text_rows()DrawableShape.apply_active_text_changes()DrawableShape.build_text_layout()DrawableShape.clean_up_temp_shapes()DrawableShape.collide_point()DrawableShape.finalise_images_and_text()DrawableShape.finalise_text()DrawableShape.finalise_text_onto_active_state()DrawableShape.full_rebuild_on_size_change()DrawableShape.get_active_state_surface()DrawableShape.get_fresh_surface()DrawableShape.get_surface()DrawableShape.has_fresh_surface()DrawableShape.insert_text()DrawableShape.redraw_active_state_no_text()DrawableShape.redraw_all_states()DrawableShape.redraw_state()DrawableShape.set_active_state()DrawableShape.set_dimensions()DrawableShape.set_position()DrawableShape.set_text()DrawableShape.set_text_alpha()DrawableShape.toggle_text_cursor()DrawableShape.update()
EllipseDrawableShapeRectDrawableShapeRoundedRectangleShapeRoundedRectangleShape.clean_up_temp_shapes()RoundedRectangleShape.clear_and_create_shape_surface()RoundedRectangleShape.collide_point()RoundedRectangleShape.create_subtract_surface()RoundedRectangleShape.draw_colourless_rounded_rectangle()RoundedRectangleShape.full_rebuild_on_size_change()RoundedRectangleShape.redraw_state()RoundedRectangleShape.set_dimensions()RoundedRectangleShape.set_position()
- pygame_gui.core.interfaces package
- Submodules
- pygame_gui.core.interfaces.container_interface module
IContainerAndContainerLikeIContainerLikeInterfaceIUIContainerInterfaceIUIContainerInterface.add_element()IUIContainerInterface.are_contents_hovered()IUIContainerInterface.calc_add_element_changes_thickness()IUIContainerInterface.change_layer()IUIContainerInterface.check_hover()IUIContainerInterface.clear()IUIContainerInterface.get_image_clipping_rect()IUIContainerInterface.get_rect()IUIContainerInterface.get_size()IUIContainerInterface.get_thickness()IUIContainerInterface.get_top_layer()IUIContainerInterface.kill()IUIContainerInterface.on_contained_elements_changed()IUIContainerInterface.recalculate_container_layer_thickness()IUIContainerInterface.remove_element()IUIContainerInterface.set_dimensions()IUIContainerInterface.set_position()IUIContainerInterface.set_relative_position()IUIContainerInterface.update_containing_rect_position()
- pygame_gui.core.interfaces.manager_interface module
IUIManagerInterfaceIUIManagerInterface.add_font_paths()IUIManagerInterface.calculate_scaled_mouse_position()IUIManagerInterface.clear_and_reset()IUIManagerInterface.copy_text_enabledIUIManagerInterface.create_tool_tip()IUIManagerInterface.draw_ui()IUIManagerInterface.get_double_click_time()IUIManagerInterface.get_focus_set()IUIManagerInterface.get_hovering_any_element()IUIManagerInterface.get_locale()IUIManagerInterface.get_mouse_position()IUIManagerInterface.get_root_container()IUIManagerInterface.get_shadow()IUIManagerInterface.get_sprite_group()IUIManagerInterface.get_theme()IUIManagerInterface.get_universal_empty_surface()IUIManagerInterface.get_window_stack()IUIManagerInterface.paste_text_enabledIUIManagerInterface.preload_fonts()IUIManagerInterface.print_layer_debug()IUIManagerInterface.print_unused_fonts()IUIManagerInterface.process_events()IUIManagerInterface.set_active_cursor()IUIManagerInterface.set_focus_set()IUIManagerInterface.set_locale()IUIManagerInterface.set_text_hovered()IUIManagerInterface.set_visual_debug_mode()IUIManagerInterface.set_window_resolution()IUIManagerInterface.update()
- pygame_gui.core.interfaces.window_interface module
IWindowInterfaceIWindowInterface.always_on_topIWindowInterface.can_hover()IWindowInterface.change_layer()IWindowInterface.check_clicked_inside_or_blocking()IWindowInterface.check_hover()IWindowInterface.get_hovering_edge_id()IWindowInterface.get_layer_thickness()IWindowInterface.get_top_layer()IWindowInterface.kill()IWindowInterface.layerIWindowInterface.on_moved_to_front()IWindowInterface.process_event()IWindowInterface.rebuild()IWindowInterface.rebuild_from_changed_theme_data()IWindowInterface.set_blocking()IWindowInterface.set_dimensions()IWindowInterface.set_display_title()IWindowInterface.set_minimum_dimensions()IWindowInterface.set_position()IWindowInterface.set_relative_position()IWindowInterface.should_use_window_edge_resize_cursor()IWindowInterface.update()
- Module contents
IColourGradientInterfaceIContainerAndContainerLikeIContainerLikeInterfaceIGUIFontInterfaceIGUIFontInterface.get_direction()IGUIFontInterface.get_metrics()IGUIFontInterface.get_padding_height()IGUIFontInterface.get_point_size()IGUIFontInterface.get_rect()IGUIFontInterface.render_premul()IGUIFontInterface.render_premul_to()IGUIFontInterface.size()IGUIFontInterface.underlineIGUIFontInterface.underline_adjustment
IGUISpriteInterfaceIGUISpriteInterface.add()IGUISpriteInterface.add_internal()IGUISpriteInterface.alive()IGUISpriteInterface.blendmodeIGUISpriteInterface.groups()IGUISpriteInterface.imageIGUISpriteInterface.kill()IGUISpriteInterface.layerIGUISpriteInterface.rectIGUISpriteInterface.remove()IGUISpriteInterface.remove_internal()IGUISpriteInterface.update()IGUISpriteInterface.visible
IUIAppearanceThemeInterfaceIUIAppearanceThemeInterface.build_all_combined_ids()IUIAppearanceThemeInterface.check_need_to_rebuild_data_manually_changed()IUIAppearanceThemeInterface.check_need_to_reload()IUIAppearanceThemeInterface.get_colour()IUIAppearanceThemeInterface.get_colour_or_gradient()IUIAppearanceThemeInterface.get_font()IUIAppearanceThemeInterface.get_font_dictionary()IUIAppearanceThemeInterface.get_font_info()IUIAppearanceThemeInterface.get_image()IUIAppearanceThemeInterface.get_image_details()IUIAppearanceThemeInterface.get_images()IUIAppearanceThemeInterface.get_misc_data()IUIAppearanceThemeInterface.get_shadow_generator()IUIAppearanceThemeInterface.load_theme()IUIAppearanceThemeInterface.reload_theming()IUIAppearanceThemeInterface.set_locale()IUIAppearanceThemeInterface.shape_cacheIUIAppearanceThemeInterface.update_caching()IUIAppearanceThemeInterface.update_single_element_theming()IUIAppearanceThemeInterface.update_theming()
IUIContainerInterfaceIUIContainerInterface.add_element()IUIContainerInterface.are_contents_hovered()IUIContainerInterface.calc_add_element_changes_thickness()IUIContainerInterface.change_layer()IUIContainerInterface.check_hover()IUIContainerInterface.clear()IUIContainerInterface.get_image_clipping_rect()IUIContainerInterface.get_rect()IUIContainerInterface.get_size()IUIContainerInterface.get_thickness()IUIContainerInterface.get_top_layer()IUIContainerInterface.kill()IUIContainerInterface.on_contained_elements_changed()IUIContainerInterface.recalculate_container_layer_thickness()IUIContainerInterface.remove_element()IUIContainerInterface.set_dimensions()IUIContainerInterface.set_position()IUIContainerInterface.set_relative_position()IUIContainerInterface.update_containing_rect_position()
IUIElementInterfaceIUIElementInterface.can_hover()IUIElementInterface.change_layer()IUIElementInterface.check_hover()IUIElementInterface.disable()IUIElementInterface.enable()IUIElementInterface.focus()IUIElementInterface.get_abs_rect()IUIElementInterface.get_anchor_targets()IUIElementInterface.get_anchors()IUIElementInterface.get_class_ids()IUIElementInterface.get_element_base_ids()IUIElementInterface.get_element_ids()IUIElementInterface.get_focus_set()IUIElementInterface.get_image_clipping_rect()IUIElementInterface.get_layer_thickness()IUIElementInterface.get_most_specific_combined_id()IUIElementInterface.get_object_ids()IUIElementInterface.get_relative_rect()IUIElementInterface.get_starting_height()IUIElementInterface.get_top_layer()IUIElementInterface.hide()IUIElementInterface.hover_point()IUIElementInterface.hoveredIUIElementInterface.is_focusedIUIElementInterface.join_focus_sets()IUIElementInterface.kill()IUIElementInterface.on_fresh_drawable_shape_ready()IUIElementInterface.on_hovered()IUIElementInterface.on_locale_changed()IUIElementInterface.on_unhovered()IUIElementInterface.process_event()IUIElementInterface.rebuild()IUIElementInterface.rebuild_from_changed_theme_data()IUIElementInterface.remove_element_from_focus_set()IUIElementInterface.set_anchors()IUIElementInterface.set_dimensions()IUIElementInterface.set_focus_set()IUIElementInterface.set_image()IUIElementInterface.set_position()IUIElementInterface.set_relative_position()IUIElementInterface.set_visual_debug_mode()IUIElementInterface.show()IUIElementInterface.ui_themeIUIElementInterface.unfocus()IUIElementInterface.update()IUIElementInterface.update_containing_rect_position()IUIElementInterface.while_hovering()
IUIFontDictionaryInterfaceIUIFontDictionaryInterface.add_font_path()IUIFontDictionaryInterface.check_font_preloaded()IUIFontDictionaryInterface.convert_html_to_point_size()IUIFontDictionaryInterface.create_font_id()IUIFontDictionaryInterface.ensure_debug_font_loaded()IUIFontDictionaryInterface.find_font()IUIFontDictionaryInterface.get_default_font()IUIFontDictionaryInterface.get_default_symbol_font()IUIFontDictionaryInterface.preload_font()IUIFontDictionaryInterface.print_unused_loaded_fonts()IUIFontDictionaryInterface.set_locale()
IUIManagerInterfaceIUIManagerInterface.add_font_paths()IUIManagerInterface.calculate_scaled_mouse_position()IUIManagerInterface.clear_and_reset()IUIManagerInterface.copy_text_enabledIUIManagerInterface.create_tool_tip()IUIManagerInterface.draw_ui()IUIManagerInterface.get_double_click_time()IUIManagerInterface.get_focus_set()IUIManagerInterface.get_hovering_any_element()IUIManagerInterface.get_locale()IUIManagerInterface.get_mouse_position()IUIManagerInterface.get_root_container()IUIManagerInterface.get_shadow()IUIManagerInterface.get_sprite_group()IUIManagerInterface.get_theme()IUIManagerInterface.get_universal_empty_surface()IUIManagerInterface.get_window_stack()IUIManagerInterface.paste_text_enabledIUIManagerInterface.preload_fonts()IUIManagerInterface.print_layer_debug()IUIManagerInterface.print_unused_fonts()IUIManagerInterface.process_events()IUIManagerInterface.set_active_cursor()IUIManagerInterface.set_focus_set()IUIManagerInterface.set_locale()IUIManagerInterface.set_text_hovered()IUIManagerInterface.set_visual_debug_mode()IUIManagerInterface.set_window_resolution()IUIManagerInterface.update()
IUITextOwnerInterfaceIUITextOwnerInterface.clear_all_active_effects()IUITextOwnerInterface.clear_text_surface()IUITextOwnerInterface.get_object_id()IUITextOwnerInterface.get_text_letter_count()IUITextOwnerInterface.set_active_effect()IUITextOwnerInterface.set_text_alpha()IUITextOwnerInterface.set_text_offset_pos()IUITextOwnerInterface.set_text_rotation()IUITextOwnerInterface.set_text_scale()IUITextOwnerInterface.stop_finished_effect()IUITextOwnerInterface.update_text_effect()IUITextOwnerInterface.update_text_end_position()
IUITooltipInterfaceIUIWindowStackInterfaceIUIWindowStackInterface.add_new_window()IUIWindowStackInterface.any_windows_in_top_stack()IUIWindowStackInterface.clear()IUIWindowStackInterface.get_full_stack()IUIWindowStackInterface.is_window_at_top()IUIWindowStackInterface.is_window_at_top_of_top()IUIWindowStackInterface.move_window_to_front()IUIWindowStackInterface.refresh_window_stack_from_window()IUIWindowStackInterface.remove_window()
IWindowInterfaceIWindowInterface.always_on_topIWindowInterface.can_hover()IWindowInterface.change_layer()IWindowInterface.check_clicked_inside_or_blocking()IWindowInterface.check_hover()IWindowInterface.get_hovering_edge_id()IWindowInterface.get_layer_thickness()IWindowInterface.get_top_layer()IWindowInterface.kill()IWindowInterface.layerIWindowInterface.on_moved_to_front()IWindowInterface.process_event()IWindowInterface.rebuild()IWindowInterface.rebuild_from_changed_theme_data()IWindowInterface.set_blocking()IWindowInterface.set_dimensions()IWindowInterface.set_display_title()IWindowInterface.set_minimum_dimensions()IWindowInterface.set_position()IWindowInterface.set_relative_position()IWindowInterface.should_use_window_edge_resize_cursor()IWindowInterface.update()
- pygame_gui.core.text package
- Submodules
- pygame_gui.core.text.horiz_rule_layout_rect module
- pygame_gui.core.text.html_parser module
- pygame_gui.core.text.hyperlink_text_chunk module
- pygame_gui.core.text.image_layout_rect module
- pygame_gui.core.text.line_break_layout_rect module
- pygame_gui.core.text.text_box_layout module
TextBoxLayoutTextBoxLayout.add_chunks_to_hover_group()TextBoxLayout.align_left_all_rows()TextBoxLayout.align_right_all_rows()TextBoxLayout.align_row()TextBoxLayout.append_layout_rects()TextBoxLayout.backspace_at_cursor()TextBoxLayout.blit_finalised_text_to_surf()TextBoxLayout.clear_effects()TextBoxLayout.clear_final_surface()TextBoxLayout.delete_at_cursor()TextBoxLayout.delete_selected_text()TextBoxLayout.finalise_to_new()TextBoxLayout.finalise_to_surf()TextBoxLayout.find_cursor_position_from_click_pos()TextBoxLayout.fit_layout_rect_height_to_rows()TextBoxLayout.get_cursor_colour()TextBoxLayout.get_cursor_index()TextBoxLayout.get_cursor_pos_move_down_one_row()TextBoxLayout.get_cursor_pos_move_up_one_row()TextBoxLayout.get_cursor_y_pos()TextBoxLayout.horiz_center_all_rows()TextBoxLayout.insert_layout_rects()TextBoxLayout.insert_line_break()TextBoxLayout.insert_text()TextBoxLayout.redraw_other_chunks()TextBoxLayout.reprocess_layout_queue()TextBoxLayout.set_alpha()TextBoxLayout.set_cursor_colour()TextBoxLayout.set_cursor_from_click_pos()TextBoxLayout.set_cursor_position()TextBoxLayout.set_cursor_to_end_of_current_row()TextBoxLayout.set_cursor_to_start_of_current_row()TextBoxLayout.set_default_text_colour()TextBoxLayout.set_default_text_shadow_colour()TextBoxLayout.set_text_selection()TextBoxLayout.toggle_cursor()TextBoxLayout.turn_off_cursor()TextBoxLayout.turn_on_cursor()TextBoxLayout.update_text_with_new_text_end_pos()TextBoxLayout.vert_align_bottom_all_rows()TextBoxLayout.vert_align_top_all_rows()TextBoxLayout.vert_center_all_rows()
- pygame_gui.core.text.text_box_layout_row module
TextBoxLayoutRowTextBoxLayoutRow.add_item()TextBoxLayoutRow.align_left_row()TextBoxLayoutRow.align_right_row()TextBoxLayoutRow.at_start()TextBoxLayoutRow.clear()TextBoxLayoutRow.clear_and_recalculate_width()TextBoxLayoutRow.finalise()TextBoxLayoutRow.find_cursor_pos_from_click_pos()TextBoxLayoutRow.get_cursor_index()TextBoxLayoutRow.get_last_text_chunk()TextBoxLayoutRow.get_last_text_or_line_break_chunk()TextBoxLayoutRow.horiz_center_row()TextBoxLayoutRow.insert_linebreak_after_chunk()TextBoxLayoutRow.insert_new_item_at_start()TextBoxLayoutRow.insert_text()TextBoxLayoutRow.last_chunk_is_line_break()TextBoxLayoutRow.merge_adjacent_compatible_chunks()TextBoxLayoutRow.rewind_row()TextBoxLayoutRow.row_text_ends_with_a_single_space()TextBoxLayoutRow.set_cursor_from_click_pos()TextBoxLayoutRow.set_cursor_position()TextBoxLayoutRow.set_cursor_to_end()TextBoxLayoutRow.set_cursor_to_start()TextBoxLayoutRow.set_default_text_colour()TextBoxLayoutRow.set_default_text_shadow_colour()TextBoxLayoutRow.string_ends_with_a_single_space()TextBoxLayoutRow.toggle_cursor()TextBoxLayoutRow.turn_off_cursor()TextBoxLayoutRow.turn_on_cursor()TextBoxLayoutRow.vert_align_items_to_row()
- pygame_gui.core.text.text_layout_rect module
- pygame_gui.core.text.text_line_chunk module
TextLineChunkFTFontTextLineChunkFTFont.add_text()TextLineChunkFTFont.backspace_letter_at_index()TextLineChunkFTFont.can_split()TextLineChunkFTFont.clear()TextLineChunkFTFont.clear_effects()TextLineChunkFTFont.delete_letter_at_index()TextLineChunkFTFont.finalise()TextLineChunkFTFont.grab_pre_effect_surface()TextLineChunkFTFont.insert_text()TextLineChunkFTFont.redraw()TextLineChunkFTFont.set_alpha()TextLineChunkFTFont.set_offset_pos()TextLineChunkFTFont.set_rotation()TextLineChunkFTFont.set_scale()TextLineChunkFTFont.split()TextLineChunkFTFont.split_index()TextLineChunkFTFont.style_match()TextLineChunkFTFont.x_pos_to_letter_index()
- Module contents
BounceEffectExpandContractEffectFadeInEffectFadeOutEffectHTMLParserHorizRuleLayoutRectHyperlinkTextChunkImageLayoutRectLineBreakLayoutRectShakeEffectSimpleTestLayoutRectTextBoxLayoutTextBoxLayout.add_chunks_to_hover_group()TextBoxLayout.align_left_all_rows()TextBoxLayout.align_right_all_rows()TextBoxLayout.align_row()TextBoxLayout.append_layout_rects()TextBoxLayout.backspace_at_cursor()TextBoxLayout.blit_finalised_text_to_surf()TextBoxLayout.clear_effects()TextBoxLayout.clear_final_surface()TextBoxLayout.delete_at_cursor()TextBoxLayout.delete_selected_text()TextBoxLayout.finalise_to_new()TextBoxLayout.finalise_to_surf()TextBoxLayout.find_cursor_position_from_click_pos()TextBoxLayout.fit_layout_rect_height_to_rows()TextBoxLayout.get_cursor_colour()TextBoxLayout.get_cursor_index()TextBoxLayout.get_cursor_pos_move_down_one_row()TextBoxLayout.get_cursor_pos_move_up_one_row()TextBoxLayout.get_cursor_y_pos()TextBoxLayout.horiz_center_all_rows()TextBoxLayout.insert_layout_rects()TextBoxLayout.insert_line_break()TextBoxLayout.insert_text()TextBoxLayout.redraw_other_chunks()TextBoxLayout.reprocess_layout_queue()TextBoxLayout.set_alpha()TextBoxLayout.set_cursor_colour()TextBoxLayout.set_cursor_from_click_pos()TextBoxLayout.set_cursor_position()TextBoxLayout.set_cursor_to_end_of_current_row()TextBoxLayout.set_cursor_to_start_of_current_row()TextBoxLayout.set_default_text_colour()TextBoxLayout.set_default_text_shadow_colour()TextBoxLayout.set_text_selection()TextBoxLayout.toggle_cursor()TextBoxLayout.turn_off_cursor()TextBoxLayout.turn_on_cursor()TextBoxLayout.update_text_with_new_text_end_pos()TextBoxLayout.vert_align_bottom_all_rows()TextBoxLayout.vert_align_top_all_rows()TextBoxLayout.vert_center_all_rows()
TextBoxLayoutRowTextBoxLayoutRow.add_item()TextBoxLayoutRow.align_left_row()TextBoxLayoutRow.align_right_row()TextBoxLayoutRow.at_start()TextBoxLayoutRow.clear()TextBoxLayoutRow.clear_and_recalculate_width()TextBoxLayoutRow.finalise()TextBoxLayoutRow.find_cursor_pos_from_click_pos()TextBoxLayoutRow.get_cursor_index()TextBoxLayoutRow.get_last_text_chunk()TextBoxLayoutRow.get_last_text_or_line_break_chunk()TextBoxLayoutRow.horiz_center_row()TextBoxLayoutRow.insert_linebreak_after_chunk()TextBoxLayoutRow.insert_new_item_at_start()TextBoxLayoutRow.insert_text()TextBoxLayoutRow.last_chunk_is_line_break()TextBoxLayoutRow.merge_adjacent_compatible_chunks()TextBoxLayoutRow.rewind_row()TextBoxLayoutRow.row_text_ends_with_a_single_space()TextBoxLayoutRow.set_cursor_from_click_pos()TextBoxLayoutRow.set_cursor_position()TextBoxLayoutRow.set_cursor_to_end()TextBoxLayoutRow.set_cursor_to_start()TextBoxLayoutRow.set_default_text_colour()TextBoxLayoutRow.set_default_text_shadow_colour()TextBoxLayoutRow.string_ends_with_a_single_space()TextBoxLayoutRow.toggle_cursor()TextBoxLayoutRow.turn_off_cursor()TextBoxLayoutRow.turn_on_cursor()TextBoxLayoutRow.vert_align_items_to_row()
TextEffectTextFloatPositionTextLayoutRectTextLineChunkFTFontTextLineChunkFTFont.add_text()TextLineChunkFTFont.backspace_letter_at_index()TextLineChunkFTFont.can_split()TextLineChunkFTFont.clear()TextLineChunkFTFont.clear_effects()TextLineChunkFTFont.delete_letter_at_index()TextLineChunkFTFont.finalise()TextLineChunkFTFont.grab_pre_effect_surface()TextLineChunkFTFont.insert_text()TextLineChunkFTFont.redraw()TextLineChunkFTFont.set_alpha()TextLineChunkFTFont.set_offset_pos()TextLineChunkFTFont.set_rotation()TextLineChunkFTFont.set_scale()TextLineChunkFTFont.split()TextLineChunkFTFont.split_index()TextLineChunkFTFont.style_match()TextLineChunkFTFont.x_pos_to_letter_index()
TiltEffectTypingAppearEffect
- pygame_gui.core.drawable_shapes package
- Submodules
- pygame_gui.core.colour_gradient module
- pygame_gui.core.colour_parser module
ColourValueParserDataNumParserTypeexpand_shorthand_hex()get_commas_outside_enclosing_glyphs()is_degree_string()is_float_str()is_int_str()is_num_str()is_percentage_string()is_u8_string()is_valid_cmy_string()is_valid_colour_name()is_valid_colour_string()is_valid_gradient_string()is_valid_hex_string()is_valid_hsl_string()is_valid_hsla_string()is_valid_hsv_string()is_valid_hsva_string()is_valid_rgb_string()is_valid_rgba_string()may_be_gradient_string()parse_cmy_string()parse_colour_model()parse_colour_name()parse_colour_or_gradient_string()parse_colour_string()parse_degree_string()parse_gradient_string()parse_hex_string()parse_hsl_string()parse_hsla_string()parse_hsv_string()parse_hsva_string()parse_percentage_string()parse_rgb_string()parse_rgba_string()parse_u8_string()split_string_at_indices()valid_enclosing_glyphs()validate_colour_model()
- pygame_gui.core.gui_font_pygame module
- pygame_gui.core.layered_gui_group module
GUISpriteLayeredGUIGroupLayeredGUIGroup.add()LayeredGUIGroup.add_internal()LayeredGUIGroup.change_layer()LayeredGUIGroup.draw()LayeredGUIGroup.get_sprites_from_layer()LayeredGUIGroup.get_top_layer()LayeredGUIGroup.has_internal()LayeredGUIGroup.layers()LayeredGUIGroup.remove_internal()LayeredGUIGroup.sprites()LayeredGUIGroup.update()LayeredGUIGroup.update_visibility()
- pygame_gui.core.object_id module
- pygame_gui.core.resource_loaders module
- pygame_gui.core.surface_cache module
CacheSurfaceDateLongTermCacheUsageDataShortTermCacheUsageDataSurfaceCacheSurfaceCache.add_surface_to_cache()SurfaceCache.add_surface_to_long_term_cache()SurfaceCache.build_cache_id()SurfaceCache.find_surface_in_cache()SurfaceCache.remove_user_and_request_clean_up_of_cached_item()SurfaceCache.remove_user_from_cache_item()SurfaceCache.split_rect()SurfaceCache.update()
- pygame_gui.core.ui_appearance_theme module
UIAppearanceThemeUIAppearanceTheme.build_all_combined_ids()UIAppearanceTheme.check_need_to_rebuild_data_manually_changed()UIAppearanceTheme.check_need_to_reload()UIAppearanceTheme.get_colour()UIAppearanceTheme.get_colour_or_gradient()UIAppearanceTheme.get_font()UIAppearanceTheme.get_font_dictionary()UIAppearanceTheme.get_font_info()UIAppearanceTheme.get_image()UIAppearanceTheme.get_image_details()UIAppearanceTheme.get_images()UIAppearanceTheme.get_misc_data()UIAppearanceTheme.get_shadow_generator()UIAppearanceTheme.load_theme()UIAppearanceTheme.reload_theming()UIAppearanceTheme.set_locale()UIAppearanceTheme.shape_cacheUIAppearanceTheme.update_caching()UIAppearanceTheme.update_single_element_theming()UIAppearanceTheme.update_theming()UIAppearanceTheme.validate_theme_data()UIAppearanceTheme.validate_theme_file_path()
UIThemeValidationErrorUIThemeValidator
- pygame_gui.core.ui_container module
UIContainerUIContainer.add_element()UIContainer.are_contents_hovered()UIContainer.calc_add_element_changes_thickness()UIContainer.change_layer()UIContainer.check_hover()UIContainer.clear()UIContainer.disable()UIContainer.enable()UIContainer.get_container()UIContainer.get_rect()UIContainer.get_size()UIContainer.get_thickness()UIContainer.get_top_layer()UIContainer.height_change_top()UIContainer.hide()UIContainer.kill()UIContainer.on_contained_elements_changed()UIContainer.recalculate_container_layer_thickness()UIContainer.remove_element()UIContainer.set_dimensions()UIContainer.set_position()UIContainer.set_relative_position()UIContainer.show()UIContainer.update_containing_rect_position()UIContainer.width_change_left()
- pygame_gui.core.ui_element module
UIElementUIElement.can_hover()UIElement.change_layer()UIElement.change_object_id()UIElement.check_hover()UIElement.disable()UIElement.enable()UIElement.focus()UIElement.get_abs_rect()UIElement.get_anchor_targets()UIElement.get_anchors()UIElement.get_class_ids()UIElement.get_element_base_ids()UIElement.get_element_ids()UIElement.get_focus_set()UIElement.get_image_clipping_rect()UIElement.get_layer_thickness()UIElement.get_most_specific_combined_id()UIElement.get_object_ids()UIElement.get_relative_rect()UIElement.get_starting_height()UIElement.get_top_layer()UIElement.hide()UIElement.hover_point()UIElement.hoveredUIElement.is_focusedUIElement.join_focus_sets()UIElement.kill()UIElement.on_fresh_drawable_shape_ready()UIElement.on_hovered()UIElement.on_locale_changed()UIElement.on_unhovered()UIElement.process_event()UIElement.rebuild()UIElement.rebuild_from_changed_theme_data()UIElement.remove_element_from_focus_set()UIElement.set_anchors()UIElement.set_container()UIElement.set_dimensions()UIElement.set_focus_set()UIElement.set_image()UIElement.set_minimum_dimensions()UIElement.set_position()UIElement.set_relative_position()UIElement.set_tooltip()UIElement.set_visual_debug_mode()UIElement.show()UIElement.tuple_extract()UIElement.ui_themeUIElement.unfocus()UIElement.update()UIElement.update_containing_rect_position()UIElement.update_theming()UIElement.while_hovering()
- pygame_gui.core.ui_font_dictionary module
DefaultFontDataUIFontDictionaryUIFontDictionary.add_font_path()UIFontDictionary.check_font_preloaded()UIFontDictionary.convert_html_to_point_size()UIFontDictionary.create_font_id()UIFontDictionary.ensure_debug_font_loaded()UIFontDictionary.find_font()UIFontDictionary.find_font_resource()UIFontDictionary.get_default_font()UIFontDictionary.get_default_symbol_font()UIFontDictionary.preload_font()UIFontDictionary.print_unused_loaded_fonts()UIFontDictionary.set_locale()
- pygame_gui.core.ui_shadow module
- pygame_gui.core.ui_window_stack module
UIWindowStackUIWindowStack.add_new_window()UIWindowStack.any_windows_in_top_stack()UIWindowStack.clear()UIWindowStack.get_full_stack()UIWindowStack.is_window_at_top()UIWindowStack.is_window_at_top_of_top()UIWindowStack.move_window_to_front()UIWindowStack.refresh_window_stack_from_window()UIWindowStack.remove_window()
- Module contents
BlockingThreadedResourceLoaderColourGradientIContainerLikeInterfaceIWindowInterfaceIWindowInterface.always_on_topIWindowInterface.can_hover()IWindowInterface.change_layer()IWindowInterface.check_clicked_inside_or_blocking()IWindowInterface.check_hover()IWindowInterface.get_hovering_edge_id()IWindowInterface.get_layer_thickness()IWindowInterface.get_top_layer()IWindowInterface.kill()IWindowInterface.layerIWindowInterface.on_moved_to_front()IWindowInterface.process_event()IWindowInterface.rebuild()IWindowInterface.rebuild_from_changed_theme_data()IWindowInterface.set_blocking()IWindowInterface.set_dimensions()IWindowInterface.set_display_title()IWindowInterface.set_minimum_dimensions()IWindowInterface.set_position()IWindowInterface.set_relative_position()IWindowInterface.should_use_window_edge_resize_cursor()IWindowInterface.update()
IncrementalThreadedResourceLoaderObjectIDShadowGeneratorTextBoxLayoutTextBoxLayout.add_chunks_to_hover_group()TextBoxLayout.align_left_all_rows()TextBoxLayout.align_right_all_rows()TextBoxLayout.align_row()TextBoxLayout.append_layout_rects()TextBoxLayout.backspace_at_cursor()TextBoxLayout.blit_finalised_text_to_surf()TextBoxLayout.clear_effects()TextBoxLayout.clear_final_surface()TextBoxLayout.delete_at_cursor()TextBoxLayout.delete_selected_text()TextBoxLayout.finalise_to_new()TextBoxLayout.finalise_to_surf()TextBoxLayout.find_cursor_position_from_click_pos()TextBoxLayout.fit_layout_rect_height_to_rows()TextBoxLayout.get_cursor_colour()TextBoxLayout.get_cursor_index()TextBoxLayout.get_cursor_pos_move_down_one_row()TextBoxLayout.get_cursor_pos_move_up_one_row()TextBoxLayout.get_cursor_y_pos()TextBoxLayout.horiz_center_all_rows()TextBoxLayout.insert_layout_rects()TextBoxLayout.insert_line_break()TextBoxLayout.insert_text()TextBoxLayout.redraw_other_chunks()TextBoxLayout.reprocess_layout_queue()TextBoxLayout.set_alpha()TextBoxLayout.set_cursor_colour()TextBoxLayout.set_cursor_from_click_pos()TextBoxLayout.set_cursor_position()TextBoxLayout.set_cursor_to_end_of_current_row()TextBoxLayout.set_cursor_to_start_of_current_row()TextBoxLayout.set_default_text_colour()TextBoxLayout.set_default_text_shadow_colour()TextBoxLayout.set_text_selection()TextBoxLayout.toggle_cursor()TextBoxLayout.turn_off_cursor()TextBoxLayout.turn_on_cursor()TextBoxLayout.update_text_with_new_text_end_pos()TextBoxLayout.vert_align_bottom_all_rows()TextBoxLayout.vert_align_top_all_rows()TextBoxLayout.vert_center_all_rows()
UIAppearanceThemeUIAppearanceTheme.build_all_combined_ids()UIAppearanceTheme.check_need_to_rebuild_data_manually_changed()UIAppearanceTheme.check_need_to_reload()UIAppearanceTheme.get_colour()UIAppearanceTheme.get_colour_or_gradient()UIAppearanceTheme.get_font()UIAppearanceTheme.get_font_dictionary()UIAppearanceTheme.get_font_info()UIAppearanceTheme.get_image()UIAppearanceTheme.get_image_details()UIAppearanceTheme.get_images()UIAppearanceTheme.get_misc_data()UIAppearanceTheme.get_shadow_generator()UIAppearanceTheme.load_theme()UIAppearanceTheme.reload_theming()UIAppearanceTheme.set_locale()UIAppearanceTheme.shape_cacheUIAppearanceTheme.update_caching()UIAppearanceTheme.update_single_element_theming()UIAppearanceTheme.update_theming()UIAppearanceTheme.validate_theme_data()UIAppearanceTheme.validate_theme_file_path()
UIContainerUIContainer.add_element()UIContainer.are_contents_hovered()UIContainer.calc_add_element_changes_thickness()UIContainer.change_layer()UIContainer.check_hover()UIContainer.clear()UIContainer.disable()UIContainer.enable()UIContainer.get_container()UIContainer.get_rect()UIContainer.get_size()UIContainer.get_thickness()UIContainer.get_top_layer()UIContainer.height_change_top()UIContainer.hide()UIContainer.kill()UIContainer.on_contained_elements_changed()UIContainer.recalculate_container_layer_thickness()UIContainer.remove_element()UIContainer.set_dimensions()UIContainer.set_position()UIContainer.set_relative_position()UIContainer.show()UIContainer.update_containing_rect_position()UIContainer.width_change_left()
UIElementUIElement.can_hover()UIElement.change_layer()UIElement.change_object_id()UIElement.check_hover()UIElement.disable()UIElement.enable()UIElement.focus()UIElement.get_abs_rect()UIElement.get_anchor_targets()UIElement.get_anchors()UIElement.get_class_ids()UIElement.get_element_base_ids()UIElement.get_element_ids()UIElement.get_focus_set()UIElement.get_image_clipping_rect()UIElement.get_layer_thickness()UIElement.get_most_specific_combined_id()UIElement.get_object_ids()UIElement.get_relative_rect()UIElement.get_starting_height()UIElement.get_top_layer()UIElement.hide()UIElement.hover_point()UIElement.hoveredUIElement.is_focusedUIElement.join_focus_sets()UIElement.kill()UIElement.on_fresh_drawable_shape_ready()UIElement.on_hovered()UIElement.on_locale_changed()UIElement.on_unhovered()UIElement.process_event()UIElement.rebuild()UIElement.rebuild_from_changed_theme_data()UIElement.remove_element_from_focus_set()UIElement.set_anchors()UIElement.set_container()UIElement.set_dimensions()UIElement.set_focus_set()UIElement.set_image()UIElement.set_minimum_dimensions()UIElement.set_position()UIElement.set_relative_position()UIElement.set_tooltip()UIElement.set_visual_debug_mode()UIElement.show()UIElement.tuple_extract()UIElement.ui_themeUIElement.unfocus()UIElement.update()UIElement.update_containing_rect_position()UIElement.update_theming()UIElement.while_hovering()
UIFontDictionaryUIFontDictionary.add_font_path()UIFontDictionary.check_font_preloaded()UIFontDictionary.convert_html_to_point_size()UIFontDictionary.create_font_id()UIFontDictionary.ensure_debug_font_loaded()UIFontDictionary.find_font()UIFontDictionary.find_font_resource()UIFontDictionary.get_default_font()UIFontDictionary.get_default_symbol_font()UIFontDictionary.preload_font()UIFontDictionary.print_unused_loaded_fonts()UIFontDictionary.set_locale()
UIWindowStackUIWindowStack.add_new_window()UIWindowStack.any_windows_in_top_stack()UIWindowStack.clear()UIWindowStack.get_full_stack()UIWindowStack.is_window_at_top()UIWindowStack.is_window_at_top_of_top()UIWindowStack.move_window_to_front()UIWindowStack.refresh_window_stack_from_window()UIWindowStack.remove_window()
- Subpackages
- pygame_gui.elements package
- Submodules
- pygame_gui.elements.ui_2d_slider module
UI2DSliderUI2DSlider.disable()UI2DSlider.enable()UI2DSlider.get_current_value()UI2DSlider.hide()UI2DSlider.kill()UI2DSlider.rebuild()UI2DSlider.rebuild_from_changed_theme_data()UI2DSlider.set_current_value()UI2DSlider.set_dimensions()UI2DSlider.set_position()UI2DSlider.set_relative_position()UI2DSlider.show()UI2DSlider.update()
- pygame_gui.elements.ui_auto_resizing_container module
- pygame_gui.elements.ui_button module
UIButtonUIButton.bind()UIButton.can_hover()UIButton.check_pressed()UIButton.disable()UIButton.enable()UIButton.get_current_image_positions()UIButton.get_current_images()UIButton.get_image_count()UIButton.get_images_by_state()UIButton.hide()UIButton.hover_point()UIButton.in_hold_range()UIButton.is_multi_image_mode()UIButton.on_hovered()UIButton.on_locale_changed()UIButton.on_self_event()UIButton.on_unhovered()UIButton.process_event()UIButton.rebuild()UIButton.rebuild_from_changed_theme_data()UIButton.select()UIButton.set_hold_range()UIButton.set_text()UIButton.unselect()UIButton.update()
- pygame_gui.elements.ui_drop_down_menu module
UIClosedDropDownStateUIClosedDropDownState.disable()UIClosedDropDownState.enable()UIClosedDropDownState.finish()UIClosedDropDownState.hide()UIClosedDropDownState.process_event()UIClosedDropDownState.rebuild()UIClosedDropDownState.show()UIClosedDropDownState.start()UIClosedDropDownState.update_dimensions()UIClosedDropDownState.update_position()
UIDropDownMenuUIDropDownMenu.add_options()UIDropDownMenu.disable()UIDropDownMenu.enable()UIDropDownMenu.hide()UIDropDownMenu.kill()UIDropDownMenu.layer_thicknessUIDropDownMenu.on_fresh_drawable_shape_ready()UIDropDownMenu.process_event()UIDropDownMenu.rebuild()UIDropDownMenu.rebuild_from_changed_theme_data()UIDropDownMenu.remove_options()UIDropDownMenu.set_dimensions()UIDropDownMenu.set_position()UIDropDownMenu.set_relative_position()UIDropDownMenu.show()UIDropDownMenu.sub_state_refresh_image()UIDropDownMenu.unfocus()UIDropDownMenu.update()
UIExpandedDropDownState
- pygame_gui.elements.ui_horizontal_scroll_bar module
UIHorizontalScrollBarUIHorizontalScrollBar.check_has_moved_recently()UIHorizontalScrollBar.disable()UIHorizontalScrollBar.enable()UIHorizontalScrollBar.hide()UIHorizontalScrollBar.kill()UIHorizontalScrollBar.process_event()UIHorizontalScrollBar.rebuild()UIHorizontalScrollBar.rebuild_from_changed_theme_data()UIHorizontalScrollBar.redraw_scrollbar()UIHorizontalScrollBar.reset_scroll_position()UIHorizontalScrollBar.set_container_to_check_hover_for_mousewheel_events()UIHorizontalScrollBar.set_dimensions()UIHorizontalScrollBar.set_position()UIHorizontalScrollBar.set_relative_position()UIHorizontalScrollBar.set_scroll_from_start_percentage()UIHorizontalScrollBar.set_visible_percentage()UIHorizontalScrollBar.show()UIHorizontalScrollBar.start_percentageUIHorizontalScrollBar.update()
- pygame_gui.elements.ui_horizontal_slider module
UIHorizontalSliderUIHorizontalSlider.disable()UIHorizontalSlider.enable()UIHorizontalSlider.get_current_value()UIHorizontalSlider.hide()UIHorizontalSlider.kill()UIHorizontalSlider.process_event()UIHorizontalSlider.rebuild()UIHorizontalSlider.rebuild_from_changed_theme_data()UIHorizontalSlider.set_current_value()UIHorizontalSlider.set_dimensions()UIHorizontalSlider.set_position()UIHorizontalSlider.set_relative_position()UIHorizontalSlider.show()UIHorizontalSlider.update()
- pygame_gui.elements.ui_image module
- pygame_gui.elements.ui_label module
UILabelUILabel.clear_all_active_effects()UILabel.clear_text_surface()UILabel.disable()UILabel.enable()UILabel.get_object_id()UILabel.get_text_letter_count()UILabel.on_locale_changed()UILabel.rebuild()UILabel.rebuild_from_changed_theme_data()UILabel.set_active_effect()UILabel.set_text()UILabel.set_text_alpha()UILabel.set_text_offset_pos()UILabel.set_text_rotation()UILabel.set_text_scale()UILabel.stop_finished_effect()UILabel.update()UILabel.update_text_effect()UILabel.update_text_end_position()
- pygame_gui.elements.ui_panel module
UIPanelUIPanel.add_background_image()UIPanel.are_contents_hovered()UIPanel.clear_background_images()UIPanel.disable()UIPanel.enable()UIPanel.get_auto_scale_images()UIPanel.get_background_image_at_index()UIPanel.get_container()UIPanel.get_current_image_positions()UIPanel.get_current_images()UIPanel.get_image_count()UIPanel.hide()UIPanel.is_multi_image_mode()UIPanel.kill()UIPanel.process_event()UIPanel.rebuild()UIPanel.rebuild_from_changed_theme_data()UIPanel.remove_background_image()UIPanel.set_anchors()UIPanel.set_auto_scale_images()UIPanel.set_background_images()UIPanel.set_dimensions()UIPanel.set_image_position()UIPanel.set_image_positions()UIPanel.set_position()UIPanel.set_relative_position()UIPanel.show()UIPanel.update()
- pygame_gui.elements.ui_progress_bar module
- pygame_gui.elements.ui_screen_space_health_bar module
- pygame_gui.elements.ui_scrolling_container module
UIScrollingContainerUIScrollingContainer.are_contents_hovered()UIScrollingContainer.disable()UIScrollingContainer.enable()UIScrollingContainer.get_container()UIScrollingContainer.hide()UIScrollingContainer.kill()UIScrollingContainer.set_anchors()UIScrollingContainer.set_dimensions()UIScrollingContainer.set_position()UIScrollingContainer.set_relative_position()UIScrollingContainer.set_scrollable_area_dimensions()UIScrollingContainer.show()UIScrollingContainer.update()
- pygame_gui.elements.ui_selection_list module
UISelectionListUISelectionList.add_items()UISelectionList.disable()UISelectionList.enable()UISelectionList.get_multi_selection()UISelectionList.get_single_selection()UISelectionList.get_single_selection_start_percentage()UISelectionList.hide()UISelectionList.kill()UISelectionList.process_event()UISelectionList.rebuild()UISelectionList.rebuild_from_changed_theme_data()UISelectionList.remove_items()UISelectionList.set_dimensions()UISelectionList.set_item_list()UISelectionList.set_position()UISelectionList.set_relative_position()UISelectionList.show()UISelectionList.update()
- pygame_gui.elements.ui_status_bar module
- pygame_gui.elements.ui_text_box module
UITextBoxUITextBox.append_html_text()UITextBox.clear()UITextBox.clear_all_active_effects()UITextBox.clear_text_surface()UITextBox.disable()UITextBox.enable()UITextBox.focus()UITextBox.full_redraw()UITextBox.get_object_id()UITextBox.get_text_layout_top_left()UITextBox.get_text_letter_count()UITextBox.hide()UITextBox.kill()UITextBox.on_fresh_drawable_shape_ready()UITextBox.on_locale_changed()UITextBox.parse_html_into_style_data()UITextBox.process_event()UITextBox.rebuild()UITextBox.rebuild_from_changed_theme_data()UITextBox.redraw_from_chunks()UITextBox.redraw_from_text_block()UITextBox.select_rangeUITextBox.set_active_effect()UITextBox.set_dimensions()UITextBox.set_position()UITextBox.set_relative_position()UITextBox.set_text()UITextBox.set_text_alpha()UITextBox.set_text_offset_pos()UITextBox.set_text_rotation()UITextBox.set_text_scale()UITextBox.show()UITextBox.stop_finished_effect()UITextBox.unfocus()UITextBox.update()UITextBox.update_text_effect()UITextBox.update_text_end_position()
- pygame_gui.elements.ui_text_entry_box module
- pygame_gui.elements.ui_text_entry_line module
UITextEntryLineUITextEntryLine.clear()UITextEntryLine.disable()UITextEntryLine.enable()UITextEntryLine.focus()UITextEntryLine.get_text()UITextEntryLine.on_locale_changed()UITextEntryLine.process_event()UITextEntryLine.rebuild()UITextEntryLine.rebuild_from_changed_theme_data()UITextEntryLine.redraw()UITextEntryLine.select_rangeUITextEntryLine.set_allowed_characters()UITextEntryLine.set_forbidden_characters()UITextEntryLine.set_text()UITextEntryLine.set_text_hidden()UITextEntryLine.set_text_length_limit()UITextEntryLine.unfocus()UITextEntryLine.update()UITextEntryLine.validate_text_string()
- pygame_gui.elements.ui_tool_tip module
- pygame_gui.elements.ui_vertical_scroll_bar module
UIVerticalScrollBarUIVerticalScrollBar.check_has_moved_recently()UIVerticalScrollBar.disable()UIVerticalScrollBar.enable()UIVerticalScrollBar.hide()UIVerticalScrollBar.kill()UIVerticalScrollBar.process_event()UIVerticalScrollBar.rebuild()UIVerticalScrollBar.rebuild_from_changed_theme_data()UIVerticalScrollBar.redraw_scrollbar()UIVerticalScrollBar.reset_scroll_position()UIVerticalScrollBar.set_container_to_check_hover_for_mousewheel_events()UIVerticalScrollBar.set_dimensions()UIVerticalScrollBar.set_position()UIVerticalScrollBar.set_relative_position()UIVerticalScrollBar.set_scroll_from_start_percentage()UIVerticalScrollBar.set_visible_percentage()UIVerticalScrollBar.show()UIVerticalScrollBar.start_percentageUIVerticalScrollBar.update()
- pygame_gui.elements.ui_window module
UIWindowUIWindow.always_on_topUIWindow.are_contents_hovered()UIWindow.can_hover()UIWindow.change_layer()UIWindow.check_clicked_inside_or_blocking()UIWindow.check_hover()UIWindow.disable()UIWindow.enable()UIWindow.get_container()UIWindow.get_hovering_edge_id()UIWindow.get_layer_thickness()UIWindow.get_relative_mouse_pos()UIWindow.get_top_layer()UIWindow.hide()UIWindow.kill()UIWindow.on_close_window_button_pressed()UIWindow.on_moved_to_front()UIWindow.process_event()UIWindow.rebuild()UIWindow.rebuild_from_changed_theme_data()UIWindow.set_blocking()UIWindow.set_dimensions()UIWindow.set_display_title()UIWindow.set_position()UIWindow.set_relative_position()UIWindow.should_use_window_edge_resize_cursor()UIWindow.show()UIWindow.update()
- pygame_gui.elements.ui_world_space_health_bar module
- Module contents
InputFieldUI2DSliderUI2DSlider.disable()UI2DSlider.enable()UI2DSlider.get_current_value()UI2DSlider.hide()UI2DSlider.kill()UI2DSlider.rebuild()UI2DSlider.rebuild_from_changed_theme_data()UI2DSlider.set_current_value()UI2DSlider.set_dimensions()UI2DSlider.set_position()UI2DSlider.set_relative_position()UI2DSlider.show()UI2DSlider.update()
UIAutoResizingContainerUIButtonUIButton.bind()UIButton.can_hover()UIButton.check_pressed()UIButton.disable()UIButton.enable()UIButton.get_current_image_positions()UIButton.get_current_images()UIButton.get_image_count()UIButton.get_images_by_state()UIButton.hide()UIButton.hover_point()UIButton.in_hold_range()UIButton.is_multi_image_mode()UIButton.on_hovered()UIButton.on_locale_changed()UIButton.on_self_event()UIButton.on_unhovered()UIButton.process_event()UIButton.rebuild()UIButton.rebuild_from_changed_theme_data()UIButton.select()UIButton.set_hold_range()UIButton.set_text()UIButton.unselect()UIButton.update()
UICheckBoxUICheckBox.can_focus()UICheckBox.can_hover()UICheckBox.disable()UICheckBox.enable()UICheckBox.focus()UICheckBox.get_current_images()UICheckBox.get_focus_set()UICheckBox.get_image_count()UICheckBox.get_images_by_state()UICheckBox.get_object_id()UICheckBox.get_state()UICheckBox.hide()UICheckBox.is_multi_image_mode()UICheckBox.is_state_indeterminate()UICheckBox.kill()UICheckBox.on_fresh_drawable_shape_ready()UICheckBox.on_hovered()UICheckBox.on_unhovered()UICheckBox.process_event()UICheckBox.rebuild()UICheckBox.rebuild_from_changed_theme_data()UICheckBox.set_check_symbol()UICheckBox.set_dimensions()UICheckBox.set_indeterminate()UICheckBox.set_indeterminate_symbol()UICheckBox.set_position()UICheckBox.set_relative_position()UICheckBox.set_state()UICheckBox.set_text()UICheckBox.set_tooltip()UICheckBox.show()UICheckBox.unfocus()
UIDropDownMenuUIDropDownMenu.add_options()UIDropDownMenu.disable()UIDropDownMenu.enable()UIDropDownMenu.hide()UIDropDownMenu.kill()UIDropDownMenu.layer_thicknessUIDropDownMenu.on_fresh_drawable_shape_ready()UIDropDownMenu.process_event()UIDropDownMenu.rebuild()UIDropDownMenu.rebuild_from_changed_theme_data()UIDropDownMenu.remove_options()UIDropDownMenu.set_dimensions()UIDropDownMenu.set_position()UIDropDownMenu.set_relative_position()UIDropDownMenu.show()UIDropDownMenu.sub_state_refresh_image()UIDropDownMenu.unfocus()UIDropDownMenu.update()
UIFormUIHorizontalScrollBarUIHorizontalScrollBar.check_has_moved_recently()UIHorizontalScrollBar.disable()UIHorizontalScrollBar.enable()UIHorizontalScrollBar.hide()UIHorizontalScrollBar.kill()UIHorizontalScrollBar.process_event()UIHorizontalScrollBar.rebuild()UIHorizontalScrollBar.rebuild_from_changed_theme_data()UIHorizontalScrollBar.redraw_scrollbar()UIHorizontalScrollBar.reset_scroll_position()UIHorizontalScrollBar.set_container_to_check_hover_for_mousewheel_events()UIHorizontalScrollBar.set_dimensions()UIHorizontalScrollBar.set_position()UIHorizontalScrollBar.set_relative_position()UIHorizontalScrollBar.set_scroll_from_start_percentage()UIHorizontalScrollBar.set_visible_percentage()UIHorizontalScrollBar.show()UIHorizontalScrollBar.start_percentageUIHorizontalScrollBar.update()
UIHorizontalSliderUIHorizontalSlider.disable()UIHorizontalSlider.enable()UIHorizontalSlider.get_current_value()UIHorizontalSlider.hide()UIHorizontalSlider.kill()UIHorizontalSlider.process_event()UIHorizontalSlider.rebuild()UIHorizontalSlider.rebuild_from_changed_theme_data()UIHorizontalSlider.set_current_value()UIHorizontalSlider.set_dimensions()UIHorizontalSlider.set_position()UIHorizontalSlider.set_relative_position()UIHorizontalSlider.show()UIHorizontalSlider.update()
UIImageUILabelUILabel.clear_all_active_effects()UILabel.clear_text_surface()UILabel.disable()UILabel.enable()UILabel.get_object_id()UILabel.get_text_letter_count()UILabel.on_locale_changed()UILabel.rebuild()UILabel.rebuild_from_changed_theme_data()UILabel.set_active_effect()UILabel.set_text()UILabel.set_text_alpha()UILabel.set_text_offset_pos()UILabel.set_text_rotation()UILabel.set_text_scale()UILabel.stop_finished_effect()UILabel.update()UILabel.update_text_effect()UILabel.update_text_end_position()
UIPanelUIPanel.add_background_image()UIPanel.are_contents_hovered()UIPanel.clear_background_images()UIPanel.disable()UIPanel.enable()UIPanel.get_auto_scale_images()UIPanel.get_background_image_at_index()UIPanel.get_container()UIPanel.get_current_image_positions()UIPanel.get_current_images()UIPanel.get_image_count()UIPanel.hide()UIPanel.is_multi_image_mode()UIPanel.kill()UIPanel.process_event()UIPanel.rebuild()UIPanel.rebuild_from_changed_theme_data()UIPanel.remove_background_image()UIPanel.set_anchors()UIPanel.set_auto_scale_images()UIPanel.set_background_images()UIPanel.set_dimensions()UIPanel.set_image_position()UIPanel.set_image_positions()UIPanel.set_position()UIPanel.set_relative_position()UIPanel.show()UIPanel.update()
UIProgressBarUIScreenSpaceHealthBarUIScrollingContainerUIScrollingContainer.are_contents_hovered()UIScrollingContainer.disable()UIScrollingContainer.enable()UIScrollingContainer.get_container()UIScrollingContainer.hide()UIScrollingContainer.kill()UIScrollingContainer.set_anchors()UIScrollingContainer.set_dimensions()UIScrollingContainer.set_position()UIScrollingContainer.set_relative_position()UIScrollingContainer.set_scrollable_area_dimensions()UIScrollingContainer.show()UIScrollingContainer.update()
UISelectionListUISelectionList.add_items()UISelectionList.disable()UISelectionList.enable()UISelectionList.get_multi_selection()UISelectionList.get_single_selection()UISelectionList.get_single_selection_start_percentage()UISelectionList.hide()UISelectionList.kill()UISelectionList.process_event()UISelectionList.rebuild()UISelectionList.rebuild_from_changed_theme_data()UISelectionList.remove_items()UISelectionList.set_dimensions()UISelectionList.set_item_list()UISelectionList.set_position()UISelectionList.set_relative_position()UISelectionList.show()UISelectionList.update()
UIStatusBarUITabContainerUITabContainer.add_tab()UITabContainer.delete_tab()UITabContainer.disable()UITabContainer.enable()UITabContainer.get_tab()UITabContainer.get_tab_container()UITabContainer.get_title_button()UITabContainer.get_title_text()UITabContainer.hide()UITabContainer.kill()UITabContainer.process_event()UITabContainer.rebuild()UITabContainer.set_anchors()UITabContainer.set_dimensions()UITabContainer.show()UITabContainer.switch_current_container()UITabContainer.tab_count
UITextBoxUITextBox.append_html_text()UITextBox.clear()UITextBox.clear_all_active_effects()UITextBox.clear_text_surface()UITextBox.disable()UITextBox.enable()UITextBox.focus()UITextBox.full_redraw()UITextBox.get_object_id()UITextBox.get_text_layout_top_left()UITextBox.get_text_letter_count()UITextBox.hide()UITextBox.kill()UITextBox.on_fresh_drawable_shape_ready()UITextBox.on_locale_changed()UITextBox.parse_html_into_style_data()UITextBox.process_event()UITextBox.rebuild()UITextBox.rebuild_from_changed_theme_data()UITextBox.redraw_from_chunks()UITextBox.redraw_from_text_block()UITextBox.select_rangeUITextBox.set_active_effect()UITextBox.set_dimensions()UITextBox.set_position()UITextBox.set_relative_position()UITextBox.set_text()UITextBox.set_text_alpha()UITextBox.set_text_offset_pos()UITextBox.set_text_rotation()UITextBox.set_text_scale()UITextBox.show()UITextBox.stop_finished_effect()UITextBox.unfocus()UITextBox.update()UITextBox.update_text_effect()UITextBox.update_text_end_position()
UITextEntryBoxUITextEntryLineUITextEntryLine.clear()UITextEntryLine.disable()UITextEntryLine.enable()UITextEntryLine.focus()UITextEntryLine.get_text()UITextEntryLine.on_locale_changed()UITextEntryLine.process_event()UITextEntryLine.rebuild()UITextEntryLine.rebuild_from_changed_theme_data()UITextEntryLine.redraw()UITextEntryLine.select_rangeUITextEntryLine.set_allowed_characters()UITextEntryLine.set_forbidden_characters()UITextEntryLine.set_text()UITextEntryLine.set_text_hidden()UITextEntryLine.set_text_length_limit()UITextEntryLine.unfocus()UITextEntryLine.update()UITextEntryLine.validate_text_string()
UITooltipUIVerticalScrollBarUIVerticalScrollBar.check_has_moved_recently()UIVerticalScrollBar.disable()UIVerticalScrollBar.enable()UIVerticalScrollBar.hide()UIVerticalScrollBar.kill()UIVerticalScrollBar.process_event()UIVerticalScrollBar.rebuild()UIVerticalScrollBar.rebuild_from_changed_theme_data()UIVerticalScrollBar.redraw_scrollbar()UIVerticalScrollBar.reset_scroll_position()UIVerticalScrollBar.set_container_to_check_hover_for_mousewheel_events()UIVerticalScrollBar.set_dimensions()UIVerticalScrollBar.set_position()UIVerticalScrollBar.set_relative_position()UIVerticalScrollBar.set_scroll_from_start_percentage()UIVerticalScrollBar.set_visible_percentage()UIVerticalScrollBar.show()UIVerticalScrollBar.start_percentageUIVerticalScrollBar.update()
UIWindowUIWindow.always_on_topUIWindow.are_contents_hovered()UIWindow.can_hover()UIWindow.change_layer()UIWindow.check_clicked_inside_or_blocking()UIWindow.check_hover()UIWindow.disable()UIWindow.enable()UIWindow.get_container()UIWindow.get_hovering_edge_id()UIWindow.get_layer_thickness()UIWindow.get_relative_mouse_pos()UIWindow.get_top_layer()UIWindow.hide()UIWindow.kill()UIWindow.on_close_window_button_pressed()UIWindow.on_moved_to_front()UIWindow.process_event()UIWindow.rebuild()UIWindow.rebuild_from_changed_theme_data()UIWindow.set_blocking()UIWindow.set_dimensions()UIWindow.set_display_title()UIWindow.set_position()UIWindow.set_relative_position()UIWindow.should_use_window_edge_resize_cursor()UIWindow.show()UIWindow.update()
UIWorldSpaceHealthBar
- pygame_gui.windows package
- Submodules
- pygame_gui.windows.ui_colour_picker_dialog module
UIColourChannelEditorUIColourPickerDialogUIColourPickerDialog.changed_hsv_update_rgb()UIColourPickerDialog.changed_rgb_update_hsv()UIColourPickerDialog.get_colour()UIColourPickerDialog.process_event()UIColourPickerDialog.set_colour()UIColourPickerDialog.update_colour_2d_slider()UIColourPickerDialog.update_current_colour_image()UIColourPickerDialog.update_saturation_value_square()
- pygame_gui.windows.ui_confirmation_dialog module
- pygame_gui.windows.ui_console_window module
- pygame_gui.windows.ui_file_dialog module
- pygame_gui.windows.ui_message_window module
- Module contents
UIColourPickerDialogUIColourPickerDialog.changed_hsv_update_rgb()UIColourPickerDialog.changed_rgb_update_hsv()UIColourPickerDialog.get_colour()UIColourPickerDialog.process_event()UIColourPickerDialog.set_colour()UIColourPickerDialog.update_colour_2d_slider()UIColourPickerDialog.update_current_colour_image()UIColourPickerDialog.update_saturation_value_square()
UIConfirmationDialogUIConsoleWindowUIFileDialogUIMessageWindow
Submodules
pygame_gui.ui_manager module
- class pygame_gui.ui_manager.UIManager(window_resolution: Tuple[int, int], theme_path: str | PathLike | StringIO | PackageResource | dict | None = None, enable_live_theme_updates: bool = True, resource_loader: IResourceLoader | None = None, starting_language: str = 'en', translation_directory_paths: List[str] | None = None)
Bases:
IUIManagerInterfaceThe UIManager is the central coordinator for all UI elements in pygame_gui. It manages the lifecycle, rendering, and event handling of UI components while maintaining proper layering and focus management.
Key Responsibilities: - Manages UI element creation, updates, and rendering - Handles event processing and focus management - Maintains UI element layering and window stacking - Manages themes and visual styling - Coordinates mouse interactions and cursor changes
Role in pygame_gui Ecosystem: The UIManager acts as the bridge between pygame's core functionality and pygame_gui's UI elements. It ensures proper coordination between different UI components and maintains the visual hierarchy.
UI Element Layering:
` +------------------+ | Window 3 | Layer 3 (Top) +------------------+ | Window 2 | Layer 2 +------------------+ | Window 1 | Layer 1 +------------------+ | Root Container | Layer 0 (Bottom) +------------------+ `Event Processing Flow: ``` pygame Event
│ ▼
- UIManager.process_events()
│ ▼
- Top Layer Elements
│ ▼
- Middle Layer Elements
│ ▼
- Bottom Layer Elements
│ ▼
- Event Consumed? ──Yes──► Stop Processing
│ No ▼
Quick Start Example: ```python import pygame import pygame_gui
pygame.init() screen = pygame.display.set_mode((800, 600)) ui_manager = pygame_gui.UIManager((800, 600))
# Create UI elements button = pygame_gui.elements.UIButton(
relative_rect=pygame.Rect((350, 275), (100, 50)), text='Hello', manager=ui_manager
)
# Main game loop while True:
time_delta = clock.tick(60)/1000.0
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
pygame.quit() exit()
ui_manager.process_events(event)
ui_manager.update(time_delta) screen.fill((0, 0, 0)) ui_manager.draw_ui(screen) pygame.display.update()
Common Use Cases: 1. Creating and managing UI windows and dialogs 2. Handling user input and events 3. Managing UI element focus and layering 4. Applying and updating themes 5. Coordinating mouse interactions
Best Practices: 1. Create only one UIManager instance per application 2. Call update() and draw_ui() every frame 3. Process events through the manager before handling game events 4. Use containers to group related UI elements 5. Preload fonts to avoid runtime loading delays
Performance Considerations: 1. Limit the number of UI elements to prevent performance degradation 2. Use containers to group elements and improve event processing 3. Preload fonts during initialization 4. Disable live theme updates in production 5. Use appropriate layer management for complex UIs
- Parameters:
window_resolution -- The resolution of the window/screen the UI will be displayed on.
theme_path -- Optional path to a theme file or theme dictionary. If None, uses default theme.
enable_live_theme_updates -- Whether to enable live theme file updates during runtime.
resource_loader -- Optional custom resource loader. If None, uses default BlockingThreadedResourceLoader.
starting_language -- The initial language code for UI text (default: "en").
translation_directory_paths -- Optional list of paths to translation files.
- add_font_paths(font_name: str, regular_path: str, bold_path: str | None = None, italic_path: str | None = None, bold_italic_path: str | None = None)
Add file paths for custom fonts you want to use in the UI. For each font name you add you can specify font files for different styles. Fonts with designed styles tend to render a lot better than fonts that are forced to make use of pygame's bold and italic styling effects, so if you plan to use bold and italic text at small sizes - find fonts with these styles available as separate files.
The font name you specify here can be used to choose the font in the blocks of HTML-subset formatted text, available in some of the UI elements like the UITextBox.
It is recommended that you also preload any fonts you use at an appropriate moment in your project rather than letting the library dynamically load them when they are required. That is because dynamic loading of large font files can cause UI elements with a lot of font usage to appear rather slowly as they are waiting for the fonts they need to load.
- Parameters:
font_name -- The name of the font that will be used to reference it elsewhere in the GUI.
regular_path -- The path of the font file for this font with no styles applied.
bold_path -- The path of the font file for this font with just bold style applied.
italic_path -- The path of the font file for this font with just italic style applied.
bold_italic_path -- The path of the font file for this font with bold & italic style applied.
- calculate_scaled_mouse_position(position: Tuple[int, int]) Tuple[int, int]
Scaling an input mouse position by a scale factor.
- clear_and_reset()
Clear all existing windows and the root container, which should get rid of all created UI elements. We then recreate the UIWindowStack and the root container.
- property copy_text_enabled: bool
Get whether we can copy any text.
- Returns:
True if we can Copy text
- create_new_theme(theme_path: str | PathLike | StringIO | PackageResource | dict | None = None) UIAppearanceTheme
Create a new theme using self information. :param theme_path: relative file path to theme or theme dictionary.
- create_tool_tip(text: str, position: Tuple[int, int], hover_distance: Tuple[int, int], parent_element: IUIElementInterface, object_id: ObjectID | None, *, wrap_width: int | None = None, text_kwargs: Dict[str, str] | None = None) IUITooltipInterface
Create a tooltip that appears when hovering over a UI element.
The tooltip is positioned relative to the parent element and will automatically adjust its position to stay within the screen bounds. The tooltip can use HTML formatting for text styling.
Example: ```python # Create a tooltip for a button tooltip = ui_manager.create_tool_tip(
text="Click me!", position=(100, 100), hover_distance=(10, 10), parent_element=my_button, object_id=ObjectID("#tooltip", "button_tooltip")
)
- param text:
The tooltip text, can utilise the HTML subset used in all UITextBoxes.
- param position:
The screen position to create the tooltip for.
- param hover_distance:
The distance we should hover away from our target position.
- param parent_element:
The UIElement that spawned this tooltip.
- param object_id:
The object_id of the tooltip for theming.
- param wrap_width:
Optional width for the tooltip, overrides theme value.
- param text_kwargs:
Dictionary of variables for text translation.
- return:
A tooltip placed somewhere on the screen.
- raises:
ValueError if position or hover_distance are invalid
- draw_ui(window_surface: Surface)
Draw all UI elements onto the provided surface. This method should be called after drawing the game's background but before updating the display.
The drawing process: 1. Elements are drawn in order from bottom-most to top-most 2. Each element is drawn according to its current state and theme 3. Elements outside the visible area are automatically clipped
Important Notes: - The surface should normally be the same size as the window resolution - For transparent surfaces, use premultiplied alpha blending - Drawing order matters for proper layering
Example: ```python # In your game loop while True:
# Draw game background screen.fill((0, 0, 0))
# Draw game elements draw_game_elements(screen)
# Draw UI on top ui_manager.draw_ui(screen)
# Update display pygame.display.update()
- Parameters:
window_surface -- The surface to draw UI elements on. Should normally be the same size as the window resolution. If using transparency, the surface should use premultiplied alpha blending.
See Also: - https://pyga.me/docs/tutorials/en/premultiplied-alpha.html for information about
premultiplied alpha blending
- get_double_click_time() float
Returns time between clicks that counts as a double click.
- Returns:
A float, time measured in seconds.
- get_focus_set()
Gets the focused set.
- Returns:
The set of elements that currently have interactive focus. If None, nothing is currently focused.
- get_hovering_any_element() bool
True if any UI element (other than the root container) is hovered by the mouse.
Combined with 'get_focus_set()' and the return value from process_events(), it should make it easier to switch input events between the UI and other parts of an application.
- get_locale()
Get the locale language code being used in the UIManager
- Returns:
A two-letter ISO 639-1 code for the current locale.
- get_root_container() IContainerAndContainerLike | None
Returns the 'root' container. The one all UI elements are placed in by default if they are not placed anywhere else, fills the whole OS/pygame window.
- Returns:
A container.
- get_shadow(size: Tuple[int, int], shadow_width: int = 2, shape: str = 'rectangle', corner_radius: List[int] | None = None) Surface
Returns a 'shadow' surface scaled to the requested size.
- Parameters:
size -- The size of the object we are shadowing + it's shadow.
shadow_width -- The width of the shadowed edge.
shape -- The shape of the requested shadow.
corner_radius -- The radius of the shadow corners if this is a rectangular shadow.
- Returns:
A shadow as a pygame Surface.
- get_sprite_group() LayeredGUIGroup
Gets the sprite group used by the entire UI to keep it in the correct order for drawing and processing input.
- Returns:
The UI's sprite group.
- get_theme() IUIAppearanceThemeInterface
Gets the theme so the data in it can be accessed.
- Returns:
The theme data used by this UIManager
- get_universal_empty_surface() Surface
Sometimes we want to hide sprites or just have sprites with no visual component, when we do we can just use this empty surface to save having lots of empty surfaces all over memory.
- Returns:
An empty and therefore invisible pygame.surface.Surface
- get_window_stack() IUIWindowStackInterface
The UIWindowStack organises any windows in the UI Manager so that they are correctly sorted and move windows we interact with to the top of the stack.
- Returns:
The stack of windows.
- property paste_text_enabled: bool
Get whether we can paste any text.
- Returns:
True if we can Paste text
- preload_fonts(font_list: List[Dict[str, str | int | float]])
It's a good idea to preload the exact fonts your program uses during the loading phase of your program. By default, the pygame_gui library will still work, but will spit out reminder warnings when you haven't done this. Loading fonts on the fly will slow down the apparent responsiveness when creating UI elements that use a lot of different fonts.
To preload custom fonts, or to use custom fonts at all (i.e. ones that aren't the default 'noto_sans' font) you must first add the paths to the files for those fonts, then load the specific fonts with a list of font descriptions in a dictionary form like so:
{'name': 'noto_sans', 'point_size': 12, 'style': 'bold_italic', 'antialiased': 1}You can specify size either in pygame.Font point sizes with 'point_size', or in HTML style sizes with 'html_size'. Style options are:
'regular''italic''bold''bold_italic'
The name parameter here must match the one you used when you added the file paths.
- Parameters:
font_list -- A list of font descriptions in dictionary format as described above.
- print_layer_debug()
Print some formatted information on the current state of the UI Layers.
Handy for debugging layer problems.
- print_unused_fonts()
Helps you identify which preloaded fonts you are actually still using in your project after you've fiddled around with the text a lot by printing out a list of fonts that have not been used yet at the time this function is called.
Of course if you don't run the code path in which a particular font is used before calling this function then it won't be of much use, so take its results under advisement rather than as gospel.
- process_events(event: Event)
Process pygame events and distribute them to appropriate UI elements. This is the main entry point for handling user input in the UI system.
The method processes events in order from top-most to bottom-most UI elements, ensuring that elements higher in the visual stack receive events first. Events are considered "consumed" when a UI element handles them, preventing them from being passed to elements below.
Side Effects: - May change the focused element - May trigger UI element state changes - May generate UI events (e.g., button clicks)
Example: ```python # In your game loop for event in pygame.event.get():
- if event.type == pygame.QUIT:
pygame.quit() exit()
# Process UI events first ui_manager.process_events(event)
# Then handle game events if not ui_manager.get_hovering_any_element():
handle_game_events(event)
- Parameters:
event -- The pygame event to process. Must be a valid pygame.event.Event object.
- Returns:
True if the event was consumed by a UI element, False otherwise.
- rebuild_all_from_changed_theme_data(theme: IUIAppearanceThemeInterface | None = None)
Rebuild the entire UI after a change in the theming.
- Parameters:
theme -- the theme that has changed.
- set_active_cursor(cursor: Cursor)
This is for users of the library to set the currently active cursor, it will be currently only be overridden by the resizing cursors.
The expected input is a pygame.cursors.Cursor:
manager.set_active_cursor(pygame.cursors.Cursor(pygame.SYSTEM_CURSOR_ARROW))
- set_focus_set(focus: IUIElementInterface | Set[IUIElementInterface] | None)
Set the focus to a single UI element or a set of related UI elements.
When an element or set of elements receives focus: 1. Previously focused elements are unfocused 2. The new element(s) receive focus 3. Focus-related events are triggered 4. Visual focus indicators are updated
Type Parameters: - focus: Optional[Union[IUIElementInterface, Set[IUIElementInterface]]]
None: Remove focus from all elements
IUIElementInterface: Focus a single element
Set[IUIElementInterface]: Focus multiple related elements
Example: ```python # Focus a single element ui_manager.set_focus_set(my_button)
# Focus a set of related elements ui_manager.set_focus_set({text_input, submit_button})
# Remove focus ui_manager.set_focus_set(None) ```
- Parameters:
focus -- The element or set of elements to focus on.
- Raises:
TypeError if focus parameter is of invalid type
- set_locale(locale: str)
Set a locale language code to use in the UIManager
- Parameters:
locale -- A two letter ISO 639-1 code for a supported language.
TODO: Make this raise an exception for an unsupported language?
- set_text_hovered(hovering_text_input: bool)
Set to true when hovering an area containing selectable text.
Currently, switches the cursor to the I-Beam cursor.
- Parameters:
hovering_text_input -- set to True to toggle the I-Beam cursor
- set_ui_theme(theme: IUIAppearanceThemeInterface, update_all_sprites: bool = False)
Set ui theme.
- Parameters:
theme -- The theme to set.
update_all_sprites
- set_visual_debug_mode(is_active: bool)
Loops through all our UIElements to turn visual debug mode on or off. Also calls print_layer_debug()
- Parameters:
is_active -- True to activate visual debug and False to turn it off.
- set_window_resolution(window_resolution: Tuple[int, int])
Sets the window resolution.
- Parameters:
window_resolution -- the resolution to set.
- update(time_delta: float)
Update the state of all UI elements and handle hover effects. This method should be called every frame to ensure proper UI element behavior.
The update process includes: 1. Checking for theme file changes (if live updates enabled) 2. Updating mouse position and hover states 3. Updating all UI elements 4. Managing cursor changes based on hover state
Side Effects: - Updates element hover states - May change the cursor appearance - May trigger theme reloads - Updates element animations and timers
Example: ```python # In your game loop clock = pygame.time.Clock() while True:
time_delta = clock.tick(60)/1000.0 # Time in seconds since last frame
# Update UI ui_manager.update(time_delta)
# Update game state update_game_state(time_delta)
- Parameters:
time_delta -- Time in seconds since the last update call. Used for animations and timing.
Module contents
Pygame GUI module
Provides bits and bobs of UI to help make more complicated interactions with games built in pygame easier to accomplish.
- class pygame_gui.PackageResource(package: str, resource: str)
Bases:
objectA data class to handle input for importlib.resources as single parameter.
- Parameters:
package -- The python package our resource is located in (e.g. 'pygame_gui.data')
resource -- The name of the resource (e.g. 'default_theme.json')
- class pygame_gui.UIManager(window_resolution: Tuple[int, int], theme_path: str | PathLike | StringIO | PackageResource | dict | None = None, enable_live_theme_updates: bool = True, resource_loader: IResourceLoader | None = None, starting_language: str = 'en', translation_directory_paths: List[str] | None = None)
Bases:
IUIManagerInterfaceThe UIManager is the central coordinator for all UI elements in pygame_gui. It manages the lifecycle, rendering, and event handling of UI components while maintaining proper layering and focus management.
Key Responsibilities: - Manages UI element creation, updates, and rendering - Handles event processing and focus management - Maintains UI element layering and window stacking - Manages themes and visual styling - Coordinates mouse interactions and cursor changes
Role in pygame_gui Ecosystem: The UIManager acts as the bridge between pygame's core functionality and pygame_gui's UI elements. It ensures proper coordination between different UI components and maintains the visual hierarchy.
UI Element Layering:
` +------------------+ | Window 3 | Layer 3 (Top) +------------------+ | Window 2 | Layer 2 +------------------+ | Window 1 | Layer 1 +------------------+ | Root Container | Layer 0 (Bottom) +------------------+ `Event Processing Flow: ``` pygame Event
│ ▼
- UIManager.process_events()
│ ▼
- Top Layer Elements
│ ▼
- Middle Layer Elements
│ ▼
- Bottom Layer Elements
│ ▼
- Event Consumed? ──Yes──► Stop Processing
│ No ▼
Quick Start Example: ```python import pygame import pygame_gui
pygame.init() screen = pygame.display.set_mode((800, 600)) ui_manager = pygame_gui.UIManager((800, 600))
# Create UI elements button = pygame_gui.elements.UIButton(
relative_rect=pygame.Rect((350, 275), (100, 50)), text='Hello', manager=ui_manager
)
# Main game loop while True:
time_delta = clock.tick(60)/1000.0
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
pygame.quit() exit()
ui_manager.process_events(event)
ui_manager.update(time_delta) screen.fill((0, 0, 0)) ui_manager.draw_ui(screen) pygame.display.update()
Common Use Cases: 1. Creating and managing UI windows and dialogs 2. Handling user input and events 3. Managing UI element focus and layering 4. Applying and updating themes 5. Coordinating mouse interactions
Best Practices: 1. Create only one UIManager instance per application 2. Call update() and draw_ui() every frame 3. Process events through the manager before handling game events 4. Use containers to group related UI elements 5. Preload fonts to avoid runtime loading delays
Performance Considerations: 1. Limit the number of UI elements to prevent performance degradation 2. Use containers to group elements and improve event processing 3. Preload fonts during initialization 4. Disable live theme updates in production 5. Use appropriate layer management for complex UIs
- Parameters:
window_resolution -- The resolution of the window/screen the UI will be displayed on.
theme_path -- Optional path to a theme file or theme dictionary. If None, uses default theme.
enable_live_theme_updates -- Whether to enable live theme file updates during runtime.
resource_loader -- Optional custom resource loader. If None, uses default BlockingThreadedResourceLoader.
starting_language -- The initial language code for UI text (default: "en").
translation_directory_paths -- Optional list of paths to translation files.
- add_font_paths(font_name: str, regular_path: str, bold_path: str | None = None, italic_path: str | None = None, bold_italic_path: str | None = None)
Add file paths for custom fonts you want to use in the UI. For each font name you add you can specify font files for different styles. Fonts with designed styles tend to render a lot better than fonts that are forced to make use of pygame's bold and italic styling effects, so if you plan to use bold and italic text at small sizes - find fonts with these styles available as separate files.
The font name you specify here can be used to choose the font in the blocks of HTML-subset formatted text, available in some of the UI elements like the UITextBox.
It is recommended that you also preload any fonts you use at an appropriate moment in your project rather than letting the library dynamically load them when they are required. That is because dynamic loading of large font files can cause UI elements with a lot of font usage to appear rather slowly as they are waiting for the fonts they need to load.
- Parameters:
font_name -- The name of the font that will be used to reference it elsewhere in the GUI.
regular_path -- The path of the font file for this font with no styles applied.
bold_path -- The path of the font file for this font with just bold style applied.
italic_path -- The path of the font file for this font with just italic style applied.
bold_italic_path -- The path of the font file for this font with bold & italic style applied.
- calculate_scaled_mouse_position(position: Tuple[int, int]) Tuple[int, int]
Scaling an input mouse position by a scale factor.
- clear_and_reset()
Clear all existing windows and the root container, which should get rid of all created UI elements. We then recreate the UIWindowStack and the root container.
- property copy_text_enabled: bool
Get whether we can copy any text.
- Returns:
True if we can Copy text
- create_new_theme(theme_path: str | PathLike | StringIO | PackageResource | dict | None = None) UIAppearanceTheme
Create a new theme using self information. :param theme_path: relative file path to theme or theme dictionary.
- create_tool_tip(text: str, position: Tuple[int, int], hover_distance: Tuple[int, int], parent_element: IUIElementInterface, object_id: ObjectID | None, *, wrap_width: int | None = None, text_kwargs: Dict[str, str] | None = None) IUITooltipInterface
Create a tooltip that appears when hovering over a UI element.
The tooltip is positioned relative to the parent element and will automatically adjust its position to stay within the screen bounds. The tooltip can use HTML formatting for text styling.
Example: ```python # Create a tooltip for a button tooltip = ui_manager.create_tool_tip(
text="Click me!", position=(100, 100), hover_distance=(10, 10), parent_element=my_button, object_id=ObjectID("#tooltip", "button_tooltip")
)
- param text:
The tooltip text, can utilise the HTML subset used in all UITextBoxes.
- param position:
The screen position to create the tooltip for.
- param hover_distance:
The distance we should hover away from our target position.
- param parent_element:
The UIElement that spawned this tooltip.
- param object_id:
The object_id of the tooltip for theming.
- param wrap_width:
Optional width for the tooltip, overrides theme value.
- param text_kwargs:
Dictionary of variables for text translation.
- return:
A tooltip placed somewhere on the screen.
- raises:
ValueError if position or hover_distance are invalid
- draw_ui(window_surface: Surface)
Draw all UI elements onto the provided surface. This method should be called after drawing the game's background but before updating the display.
The drawing process: 1. Elements are drawn in order from bottom-most to top-most 2. Each element is drawn according to its current state and theme 3. Elements outside the visible area are automatically clipped
Important Notes: - The surface should normally be the same size as the window resolution - For transparent surfaces, use premultiplied alpha blending - Drawing order matters for proper layering
Example: ```python # In your game loop while True:
# Draw game background screen.fill((0, 0, 0))
# Draw game elements draw_game_elements(screen)
# Draw UI on top ui_manager.draw_ui(screen)
# Update display pygame.display.update()
- Parameters:
window_surface -- The surface to draw UI elements on. Should normally be the same size as the window resolution. If using transparency, the surface should use premultiplied alpha blending.
See Also: - https://pyga.me/docs/tutorials/en/premultiplied-alpha.html for information about
premultiplied alpha blending
- get_double_click_time() float
Returns time between clicks that counts as a double click.
- Returns:
A float, time measured in seconds.
- get_focus_set()
Gets the focused set.
- Returns:
The set of elements that currently have interactive focus. If None, nothing is currently focused.
- get_hovering_any_element() bool
True if any UI element (other than the root container) is hovered by the mouse.
Combined with 'get_focus_set()' and the return value from process_events(), it should make it easier to switch input events between the UI and other parts of an application.
- get_locale()
Get the locale language code being used in the UIManager
- Returns:
A two-letter ISO 639-1 code for the current locale.
- get_root_container() IContainerAndContainerLike | None
Returns the 'root' container. The one all UI elements are placed in by default if they are not placed anywhere else, fills the whole OS/pygame window.
- Returns:
A container.
- get_shadow(size: Tuple[int, int], shadow_width: int = 2, shape: str = 'rectangle', corner_radius: List[int] | None = None) Surface
Returns a 'shadow' surface scaled to the requested size.
- Parameters:
size -- The size of the object we are shadowing + it's shadow.
shadow_width -- The width of the shadowed edge.
shape -- The shape of the requested shadow.
corner_radius -- The radius of the shadow corners if this is a rectangular shadow.
- Returns:
A shadow as a pygame Surface.
- get_sprite_group() LayeredGUIGroup
Gets the sprite group used by the entire UI to keep it in the correct order for drawing and processing input.
- Returns:
The UI's sprite group.
- get_theme() IUIAppearanceThemeInterface
Gets the theme so the data in it can be accessed.
- Returns:
The theme data used by this UIManager
- get_universal_empty_surface() Surface
Sometimes we want to hide sprites or just have sprites with no visual component, when we do we can just use this empty surface to save having lots of empty surfaces all over memory.
- Returns:
An empty and therefore invisible pygame.surface.Surface
- get_window_stack() IUIWindowStackInterface
The UIWindowStack organises any windows in the UI Manager so that they are correctly sorted and move windows we interact with to the top of the stack.
- Returns:
The stack of windows.
- property paste_text_enabled: bool
Get whether we can paste any text.
- Returns:
True if we can Paste text
- preload_fonts(font_list: List[Dict[str, str | int | float]])
It's a good idea to preload the exact fonts your program uses during the loading phase of your program. By default, the pygame_gui library will still work, but will spit out reminder warnings when you haven't done this. Loading fonts on the fly will slow down the apparent responsiveness when creating UI elements that use a lot of different fonts.
To preload custom fonts, or to use custom fonts at all (i.e. ones that aren't the default 'noto_sans' font) you must first add the paths to the files for those fonts, then load the specific fonts with a list of font descriptions in a dictionary form like so:
{'name': 'noto_sans', 'point_size': 12, 'style': 'bold_italic', 'antialiased': 1}You can specify size either in pygame.Font point sizes with 'point_size', or in HTML style sizes with 'html_size'. Style options are:
'regular''italic''bold''bold_italic'
The name parameter here must match the one you used when you added the file paths.
- Parameters:
font_list -- A list of font descriptions in dictionary format as described above.
- print_layer_debug()
Print some formatted information on the current state of the UI Layers.
Handy for debugging layer problems.
- print_unused_fonts()
Helps you identify which preloaded fonts you are actually still using in your project after you've fiddled around with the text a lot by printing out a list of fonts that have not been used yet at the time this function is called.
Of course if you don't run the code path in which a particular font is used before calling this function then it won't be of much use, so take its results under advisement rather than as gospel.
- process_events(event: Event)
Process pygame events and distribute them to appropriate UI elements. This is the main entry point for handling user input in the UI system.
The method processes events in order from top-most to bottom-most UI elements, ensuring that elements higher in the visual stack receive events first. Events are considered "consumed" when a UI element handles them, preventing them from being passed to elements below.
Side Effects: - May change the focused element - May trigger UI element state changes - May generate UI events (e.g., button clicks)
Example: ```python # In your game loop for event in pygame.event.get():
- if event.type == pygame.QUIT:
pygame.quit() exit()
# Process UI events first ui_manager.process_events(event)
# Then handle game events if not ui_manager.get_hovering_any_element():
handle_game_events(event)
- Parameters:
event -- The pygame event to process. Must be a valid pygame.event.Event object.
- Returns:
True if the event was consumed by a UI element, False otherwise.
- rebuild_all_from_changed_theme_data(theme: IUIAppearanceThemeInterface | None = None)
Rebuild the entire UI after a change in the theming.
- Parameters:
theme -- the theme that has changed.
- set_active_cursor(cursor: Cursor)
This is for users of the library to set the currently active cursor, it will be currently only be overridden by the resizing cursors.
The expected input is a pygame.cursors.Cursor:
manager.set_active_cursor(pygame.cursors.Cursor(pygame.SYSTEM_CURSOR_ARROW))
- set_focus_set(focus: IUIElementInterface | Set[IUIElementInterface] | None)
Set the focus to a single UI element or a set of related UI elements.
When an element or set of elements receives focus: 1. Previously focused elements are unfocused 2. The new element(s) receive focus 3. Focus-related events are triggered 4. Visual focus indicators are updated
Type Parameters: - focus: Optional[Union[IUIElementInterface, Set[IUIElementInterface]]]
None: Remove focus from all elements
IUIElementInterface: Focus a single element
Set[IUIElementInterface]: Focus multiple related elements
Example: ```python # Focus a single element ui_manager.set_focus_set(my_button)
# Focus a set of related elements ui_manager.set_focus_set({text_input, submit_button})
# Remove focus ui_manager.set_focus_set(None) ```
- Parameters:
focus -- The element or set of elements to focus on.
- Raises:
TypeError if focus parameter is of invalid type
- set_locale(locale: str)
Set a locale language code to use in the UIManager
- Parameters:
locale -- A two letter ISO 639-1 code for a supported language.
TODO: Make this raise an exception for an unsupported language?
- set_text_hovered(hovering_text_input: bool)
Set to true when hovering an area containing selectable text.
Currently, switches the cursor to the I-Beam cursor.
- Parameters:
hovering_text_input -- set to True to toggle the I-Beam cursor
- set_ui_theme(theme: IUIAppearanceThemeInterface, update_all_sprites: bool = False)
Set ui theme.
- Parameters:
theme -- The theme to set.
update_all_sprites
- set_visual_debug_mode(is_active: bool)
Loops through all our UIElements to turn visual debug mode on or off. Also calls print_layer_debug()
- Parameters:
is_active -- True to activate visual debug and False to turn it off.
- set_window_resolution(window_resolution: Tuple[int, int])
Sets the window resolution.
- Parameters:
window_resolution -- the resolution to set.
- update(time_delta: float)
Update the state of all UI elements and handle hover effects. This method should be called every frame to ensure proper UI element behavior.
The update process includes: 1. Checking for theme file changes (if live updates enabled) 2. Updating mouse position and hover states 3. Updating all UI elements 4. Managing cursor changes based on hover state
Side Effects: - Updates element hover states - May change the cursor appearance - May trigger theme reloads - Updates element animations and timers
Example: ```python # In your game loop clock = pygame.time.Clock() while True:
time_delta = clock.tick(60)/1000.0 # Time in seconds since last frame
# Update UI ui_manager.update(time_delta)
# Update game state update_game_state(time_delta)
- Parameters:
time_delta -- Time in seconds since the last update call. Used for animations and timing.
- class pygame_gui.UITextEffectType(name)
Bases:
objectA Type for Text effect constants, so we can mess with them later if needs be
- pygame_gui.performance_monitor(operation_name: str)
Decorator to monitor performance of operations and identify bottlenecks.
This decorator measures the execution time of functions and logs a warning if the operation takes longer than 16.67 milliseconds (60 FPS frame time). This helps identify performance issues that could impact UI responsiveness in real-time applications.
- Parameters:
operation_name -- A descriptive name for the operation being monitored.
- Example usage:
@performance_monitor("Theme Loading") def load_theme_data(self):
# ... complex theme loading logic ... pass
- The decorator will automatically log slow operations like:
"SLOW OPERATION: Theme Loading took 25.43ms"