So I was trying to make a game with python and pygame but I noticed that I couldn't make a high resolution display because when I tried to make a display with more pixels, the pygame window was too big for my 4k (3840x2160) monitor. I should note that my monitor is connected to an old Dell laptop with a resolution of (1366x768). But when I entered this: print(pygame.display.list_modes()) it told me that I could use resolutions up to 4k and not just up to the resolution of my laptop. After a lot of searching and trying I accepted the fact that my game will be low resolution and moved on. As I continued coding the game I wanted to have a pop-up window so I imported pyautogui and my pygame window suddenly became much smaller. BOOM problem solved. I increased the resolution and I had no problems, my game was now running at a very high resolution! I was very confused so I made a very simple pygame program so I could test this and it actually worked. This is low quality and can't fit in my screen:
import pygame
import sys
pygame.init()
screen = pygame.display.set_mode((3000, 1500))
font = pygame.font.Font('font.otf', 50)
while True:
screen.fill((255, 255, 255))
txt = font.render("hello", True, (0, 0, 0))
screen.blit(txt, (100, 100))
pygame.display.update()
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
And this is high resolution and does fit in my screen:
import pygame
import sys
import pyautogui
pygame.init()
screen = pygame.display.set_mode((3000, 1500))
font = pygame.font.Font('font.otf', 50)
while True:
screen.fill((255, 255, 255))
txt = font.render("hello", True, (0, 0, 0))
screen.blit(txt, (100, 100))
pygame.display.update()
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
I don't even need to use pyautogui! Can someone explain this to me? Thanks