[Python] Can a screen.draw.textbox function be passed an image

Discussão em 'Python' iniciado por Stack, Março 22, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to make a pygame zero game. The step I am up to is choosing the character I have some images and i want to create interactive character selection buttons using images. I am currently using screen.blit

    Here is my code:

    def draw_button(rect, text, color='yellow'):
    screen.draw.filled_rect(rect, color)
    screen.draw.textbox(text, rect, fontname='impact', color='black')


    screen.blit('thor', spaces_char[0])
    screen.blit('loki', spaces_char[1])


    I have been looking for a way on the internet but they are very unhelpful because i am using pygame zero, not pygame!!!!! I tried with the code above. Does Surface work? Really what I am trying to do is make a Rect to be detected with on_mouse_down() The files are thor.png and loki.png Thanks

    Continue reading...

Compartilhe esta Página