0
I was trying to put a text inside a pygame screen in a specific coordinate, what can I do to print a text and restrict its area?
import sys, pygame
pygame.init()
size = width, height = 800, 600
speed = [0, 0]
black = 0, 0, 0
screen = pygame.display.set_mode(size)
fundo = pygame.image.load("baner.jpg")
dialogo = pygame.image.load("dialogo.png")
estatico = fundo.get_rect()
while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
estatico = estatico.move(speed)
if estatico.left < 0 or estatico.right > width:
speed[0] = -speed[0]
if estatico.top < 0 or estatico.bottom > height:
speed[1] = -speed[1]
screen.fill(black)
screen.blit(fundo, estatico)
screen.blit(dialogo, estatico)
pygame.display.flip()
This is what I have so far, two images and wanted to put a text on top of the dialog box
It’s cool that you want to help, but you need to take some care with formatting, and maybe an explanation not only within the code would be interesting. I formatted to try to make it more readable, but feel free to [Edit] as you think necessary. Note that to format the code I used the button
{ }
from the format bar.– Bacco