pygame_gui icon indicating copy to clipboard operation
pygame_gui copied to clipboard

UIScrollbars created by UITextBox and UITextEntryBox don't match the box's anchors

Open GimLala opened this issue 1 year ago • 1 comments

Describe the bug When the text boxes are created with anchor targets, The scrollbars created by them do not match the anchors which makes them appear disconnected from the boxes.

To Reproduce Code to reproduce the behaviour

import pygame
import pygame_gui


pygame.init()

pygame.display.set_caption('Quick Start')
window_surface = pygame.display.set_mode((800, 600))

background = pygame.Surface((800, 600))
background.fill(pygame.Color('#000000'))

manager = pygame_gui.UIManager((800, 600))

hello_button = pygame_gui.elements.UIButton(relative_rect=pygame.Rect((350, 275), (100, 50)),
                                            text='Say Hello',
                                            manager=manager)
text_box = pygame_gui.elements.UITextBox("A really long piece of text in the text box ", relative_rect=pygame.Rect(20, 30, 250, 50), anchors={"left_target": hello_button, "top_target": hello_button})

clock = pygame.time.Clock()
is_running = True

while is_running:
    time_delta = clock.tick(60)/1000.0
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            is_running = False

        manager.process_events(event)

    manager.update(time_delta)

    window_surface.blit(background, (0, 0))
    manager.draw_ui(window_surface)

    pygame.display.update()

Expected behaviour I expected the scrollbar to appear next to the text box

Screenshots image

Platform and software (please complete the following information):

  • OS: Windows
  • Pygame GUI version 0.6.8
  • Pygame version 2.1.0

GimLala avatar Jan 30 '24 13:01 GimLala