Pygame image isn't fitting even it is the same size as the screen

31 views Asked by At

I'm making a Legends of Runeterra simulator (just to train and play around) in pygame and I want have a customized background image that I made with pillow that changes with some situations. The image size is (1920, 1080) that is my monitor size and my pygame screen is defined as this same size. But when I open the image in pygame it cuts the first 200 pixels horizontaly and I don't know why.

I could fix it by putting the image 200 pixels to the right, but this would cut the image and would mess with my X and Y clicks detectors.

There is the image I'm putting into the pygame and how it enter: (I have to put a Imgur link cause the image is bigger that 2mb) https://imgur.com/dmXuboa https://imgur.com/a/0FnC3U8

The pygame code is:

import Core
import pygame
import random
import Bancoterra
import copy

pygame.init()

clock = pygame.time.Clock()

tam_tela = (1920, 1080)
tela = pygame.display.set_mode(tam_tela)
pygame.display.set_caption("Legends of Runeterra")

jog1 = []
x = 0
for i in Bancoterra.Banco:
    jog1.append(copy.copy(i))
    jog1.append(copy.copy(i))
    if len(jog1) < 36:
        jog1.append(copy.copy(i))
    x += 1
jog2 = copy.copy(jog1)

infos = Core.informacoes(Bancoterra.Jogador(jog1), Bancoterra.Jogador(jog2))

progras = True
while progras:
    clique = (-200, -200)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            progras = False
        if event.type == pygame.MOUSEBUTTONDOWN:
            if pygame.mouse.get_pressed()[0]:
                clique = pygame.mouse.get_pos()

**    num = Core.jogo(infos, clique)
    num[0] = num[0].save("tabuleiro.png")

    imp = pygame.image.load("tabuleiro.png")
    tela.blit(imp, (0, 0))**

    if num[1] is True:
        res = 0
        ganhador = []
        if infos.ordem[0].vida <= 0:
            res += 1
        if infos.ordem[1].vida <= 0:
            res -= 1
        if res == 1:
            ganhador.append(infos.ordem[0])
        elif res == -1:
            ganhador.append(infos.ordem[1])
        else:
            ganhador.append(infos.ordem)
        # progras = False

    pygame.display.flip()
    clock.tick(60)

pygame.quit()

1

There are 1 answers

0
TheJoing On

I thought that my device resolution was my screen resolution. So the solution was to use all my images as my screen resolution