重新调整像素的大小 pygame [英] Rescale pixel's size pygame

查看:61
本文介绍了重新调整像素的大小 pygame的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 pygame 1.9.如何使窗口更大,而不是由像素大小确定的大小.例如,我创建了 100x100 像素的显示.并用numpy数组填充它.

I'm using pygame 1.9. How to make window bigger, than it's size definite by pixel's size. For example, I create display with 100x100 pixel. And fill it by numpy array.

screenarray=np.zeros((100, 100))
screenarray.fill(10)
screen = pygame.display.set_mode((100,100))
surface = pygame.surfarray.make_surface(screenarray)
screen.blit(surface, (0, 0))
pygame.display.flip()

而且它太小了,我什至什么都看不到.我想按显示器的 600x600 像素重新缩放它.如何重新调整像素大小"?

And it's too small, I even can see anything. I want to rescale it by 600x600 pixels of my display. How to rescale "pixel's size"?

推荐答案

我不太明白你想解释的内容,但也许 newSurface = pygame.transform.scale(surface, (newWidth, newHeight)) 是正确的给你.

I do not really get what you were trying to explain but maybe newSurface = pygame.transform.scale(surface, (newWidth, newHeight)) is the right thing for you.

这篇关于重新调整像素的大小 pygame的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆