python - Pygame borderless opening with some offset -
when try open borderless mode window start in top right corner of screen. looks this: http://puu.sh/ivb4y/304018da5e.jpg code looks this
if __name__ == "__main__": import source.game, pygame pygame.mixer.pre_init(22050, 16, 2, 256) pygame.font.init() pygame.init() screen = pygame.display.set_mode((1920, 1080), pygame.noframe) source.game.game().main(screen)
it might worth noting i'm running 2 monitors, i've tried running 1 , problem still happens, , if take resolution down below native still won't start in top right of screen.
is there way fix such problem?
edit:
i went answers looking on in future.
import os os.environ['sdl_video_window_pos'] = "0,0" screen = pygame.display.set_mode((1920, 1080), pygame.noframe)
along other .init() statements , whatnot.
looks want fullscreen:
screen = pygame.display.set_mode((1920, 1080), pygame.fullscreen)
you might want turn on hardware acceleration adn double buffering using pygame.hwsurface | pygame.doublebuf
if running fullscreen.
display.set_mode
docs: https://www.pygame.org/docs/ref/display.html#pygame.display.set_mode
if want keep os's bar on screen, instead of going fullscreen, ideally maximize window after creating it. however, version of sdl lib pygame built on not support maximize operation (sdl 2 does). apparently, can control position of window setting environment variable before initializing window (yuck), still need figure out usable area of desktop. example:
import os os.environ['sdl_video_window_pos'] = "0,0" import pygame pygame.init() screen = pygame.display.set_mode((100,100))
Comments
Post a Comment