我开始探索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)
在视频中他的显示正确,我的看起来像这样

使用:
我认为要么与视网膜显示有关,要么我安装错了.任何帮助,将不胜感激.
| 归档时间: |
|
| 查看次数: |
1423 次 |
| 最近记录: |