屏幕仅显示在窗口的左上角

Sam*_*Sam 5 python pygame

我开始探索Python和Pygame,但是我遇到了一个问题.我绘制到屏幕上的所有内容都只显示在窗口的左上角.我以为这是我的代码,但我试过的任何演示程序也以同样的方式显示.

在youtube上来自thenewboston的演示代码

import pygame, sys
from pygame.locals import *

pygame.init()

screen = pygame.display.set_mode((640,360),0,32)

background = pygame.image.load("Background.jpg").convert()
mouse_c = pygame.image.load("ball.png").convert_alpha()

while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()

    screen.blit(background, (0,0))

    x,y = pygame.mouse.get_pos()
    x -= mouse_c.get_width()/2
    y -= mouse_c.get_height()/2

    screen.blit(mouse_c, (x,y))

    pygame.display.update()
Run Code Online (Sandbox Code Playgroud)

在视频中他的显示正确,我的看起来像这样 游戏渲染的屏幕截图仅在屏幕的左上角

使用:

  • Python 2.7.4 32位
  • pygame 1.9.1 32位
  • mac 10.8.3 64位macbook pro视网膜上

我认为要么与视网膜显示有关,要么我安装错了.任何帮助,将不胜感激.

小智 6

事实上,问题在于视网膜屏幕的分辨率.为了让pygame正常工作,请下载setresx并使用它将分辨率设置为任何没有HiDPI的设置.