Skip to main content
added markdown to code in text, moved urls to in text links, fixed code formatting typo that hid first line of code
Source Link
Pikalek
  • 13.4k
  • 5
  • 49
  • 54

Pygame display.Info() / fullscreen not working under Linux

I am experiencing some issues with pygame.display.Info()pygame.display.Info() and the FULLSCREENFULLSCREEN property on Linux. The game is displaying at roughly 1.5 times the size of the screen. I saw from other questions that there is a known workaround for Windows, but nothing for Linux. I am posting this question because StackExchange won't allow me to comment on the other chains until I have more reputation.

The other two questions:

https://stackoverflow.com/questions/27421391/pygame-display-info-giving-wrong-resolution-size

Pygame Fullsreen Display Issue

One of the proposed solutions for Windows was to insert three lines of code:

ctypes.windll.user32.SetProcessDPIAware()
true_res = (windll.user32.GetSystemMetrics(0),windll.user32.GetSystemMetrics(1))
pygame.display.set_mode(true_res,pygame.Fullscreen)

The code above makes use of CTypes, which is why only Windows has a solution thus far. I appreciate any help!

Below is the section of code in my project giving me trouble.


# Initialize pygame
pygame.init()

# Get screen info for fullscreen
screen_info = pygame.display.Info()
WIDTH = screen_info.current_w
HEIGHT = screen_info.current_h

# Screen setup - fullscreen mode
screen = pygame.display.set_mode((WIDTH, HEIGHT), pygame.FULLSCREEN)
import pygame

# Initialize pygame
pygame.init()

# Get screen info for fullscreen
screen_info = pygame.display.Info()
WIDTH = screen_info.current_w
HEIGHT = screen_info.current_h

# Screen setup - fullscreen mode
screen = pygame.display.set_mode((WIDTH, HEIGHT), pygame.FULLSCREEN)

Pygame display.Info() / fullscreen not working

I am experiencing some issues with pygame.display.Info() and the FULLSCREEN property on Linux. The game is displaying at roughly 1.5 times the size of the screen. I saw from other questions that there is a known workaround for Windows, but nothing for Linux. I am posting this question because StackExchange won't allow me to comment on the other chains until I have more reputation.

The other two questions:

https://stackoverflow.com/questions/27421391/pygame-display-info-giving-wrong-resolution-size

Pygame Fullsreen Display Issue

One of the proposed solutions for Windows was to insert three lines of code:

ctypes.windll.user32.SetProcessDPIAware()
true_res = (windll.user32.GetSystemMetrics(0),windll.user32.GetSystemMetrics(1))
pygame.display.set_mode(true_res,pygame.Fullscreen)

The code above makes use of CTypes, which is why only Windows has a solution thus far. I appreciate any help!

Below is the section of code in my project giving me trouble.


# Initialize pygame
pygame.init()

# Get screen info for fullscreen
screen_info = pygame.display.Info()
WIDTH = screen_info.current_w
HEIGHT = screen_info.current_h

# Screen setup - fullscreen mode
screen = pygame.display.set_mode((WIDTH, HEIGHT), pygame.FULLSCREEN)

Pygame display.Info() / fullscreen not working under Linux

I am experiencing some issues with pygame.display.Info() and the FULLSCREEN property on Linux. The game is displaying at roughly 1.5 times the size of the screen. I saw from other questions that there is a known workaround for Windows, but nothing for Linux. I am posting this question because StackExchange won't allow me to comment on the other chains until I have more reputation.

The other two questions:

One of the proposed solutions for Windows was to insert three lines of code:

ctypes.windll.user32.SetProcessDPIAware()
true_res = (windll.user32.GetSystemMetrics(0),windll.user32.GetSystemMetrics(1))
pygame.display.set_mode(true_res,pygame.Fullscreen)

The code above makes use of CTypes, which is why only Windows has a solution thus far. I appreciate any help!

Below is the section of code in my project giving me trouble.

import pygame

# Initialize pygame
pygame.init()

# Get screen info for fullscreen
screen_info = pygame.display.Info()
WIDTH = screen_info.current_w
HEIGHT = screen_info.current_h

# Screen setup - fullscreen mode
screen = pygame.display.set_mode((WIDTH, HEIGHT), pygame.FULLSCREEN)
Source Link

Pygame display.Info() / fullscreen not working

I am experiencing some issues with pygame.display.Info() and the FULLSCREEN property on Linux. The game is displaying at roughly 1.5 times the size of the screen. I saw from other questions that there is a known workaround for Windows, but nothing for Linux. I am posting this question because StackExchange won't allow me to comment on the other chains until I have more reputation.

The other two questions:

https://stackoverflow.com/questions/27421391/pygame-display-info-giving-wrong-resolution-size

Pygame Fullsreen Display Issue

One of the proposed solutions for Windows was to insert three lines of code:

ctypes.windll.user32.SetProcessDPIAware()
true_res = (windll.user32.GetSystemMetrics(0),windll.user32.GetSystemMetrics(1))
pygame.display.set_mode(true_res,pygame.Fullscreen)

The code above makes use of CTypes, which is why only Windows has a solution thus far. I appreciate any help!

Below is the section of code in my project giving me trouble.


# Initialize pygame
pygame.init()

# Get screen info for fullscreen
screen_info = pygame.display.Info()
WIDTH = screen_info.current_w
HEIGHT = screen_info.current_h

# Screen setup - fullscreen mode
screen = pygame.display.set_mode((WIDTH, HEIGHT), pygame.FULLSCREEN)