i cant seem to get images to scroll in a container, any ideas or examples?
the scrollbars appear but when i click them nothing happens, i was expecting it work like like the scrolling text example.
# Initialize Pygame and create the window
pygame.init()
window_surface = pygame.display.set_mode(WINDOW_SIZE)
ui_manager = pygame_gui.UIManager(WINDOW_SIZE)
# Create the UIScrollingContainer for the scrollable image area
container_rect = pygame.Rect(COLUMN_1_WIDTH, 0, COLUMN_2_WIDTH, WINDOW_SIZE[1])
scrolling_container = UIScrollingContainer(container_rect, manager=ui_manager)
while running:
dt = clock.tick(60) / 1000.0
window_surface.fill(background_color)
# Handle events
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
ui_manager.process_events(event)
# Update the UI manager
ui_manager.update(dt)
# Draw the content within the scrolling container
if current_image_surface:
scrolling_container.get_container().clear()
if is_animating and current_gif_frames:
animation_timer += dt * 1000 # Convert dt to milliseconds
if animation_timer >= animation_speed:
animation_timer = 0
current_gif_index = (current_gif_index + 1) % len(current_gif_frames)
current_image_surface = current_gif_frames[current_gif_index]
zoomed_surface = pygame.transform.rotozoom(current_image_surface, 0, current_zoom)
image_rect = zoomed_surface.get_rect()
# Adjust the scrollable area size to match the image size
scrolling_container.set_scrollable_area_dimensions((image_rect.width, image_rect.height))
# Add the UIImage to the scrolling container (re-create each frame for simplicity)
UIImage(relative_rect=pygame.Rect((0, 0), (image_rect.width, image_rect.height)),
image_surface=zoomed_surface,
manager=ui_manager,
container=scrolling_container)
i cant seem to get images to scroll in a container, any ideas or examples? the scrollbars appear but when i click them nothing happens, i was expecting it work like like the scrolling text example.