简体   繁体   English

我要在pygame.Surface()中放入什么?

[英]What do I put inside a pygame.Surface()?

block1 = pygame.Surface(?,?)

when I ran it it gave me an error stating 当我运行它给我一个错误说明

ValueError: size needs to be (int width, int height) ValueError:大小必须为(整数宽度,整数高度)

The first argument of pygame.Surface is a tuple which represents the size of the surface. pygame.Surface的第一个参数是一个表示表面尺寸的元组。 Therefore, you need to provide these arguments when calling it: 因此,在调用它时需要提供以下参数:

width = 600
height = 400
block1 = pygame.Surface((width, height))
pygame.Surface((width, height), flags=0, depth=0, masks=None) -> Surface

阅读文档确实有助于理解它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “TypeError: must be pygame.Surface, not tuple”怎么办? (pygame 启动器) - "TypeError: must be pygame.Surface, not tuple" what to do? (pygame starter) “参数 1 必须是 pygame.Surface,而不是 pygame.Rect”我该如何解决这个问题,它在说什么? - "argument 1 must be pygame.Surface, not pygame.Rect" How do I fix this, what is it saying? 获取 pygame.Surface 错误。 我该如何解决? - Getting pygame.Surface Error. How do I fix? 我收到参数 1 的错误必须是 pygame.Surface,而不是 None。 我该如何解决 - I am getting an error with argument 1 must be pygame.Surface, not None. How do I fix this 如何解决错误“ AttributeError:'pygame.Surface'对象没有属性'units'”? - How do I fix the error “AttributeError: 'pygame.Surface' object has no attribute 'units'”? 如何将 OpenCV (cv2) 图像(BGR 和 BGRA)转换为 pygame.Surface 对象 - How do I convert an OpenCV (cv2) image (BGR and BGRA) to a pygame.Surface object 如何解决此错误:TypeError:参数1必须是pygame.Surface,而不是PngImageFile - How do I resolve this error: TypeError: argument 1 must be pygame.Surface, not PngImageFile 如何解决 AttributeError: module pygame.surface has no attribute rect - How do I solve AttributeError: module pygame.surface has no attribute rect pygame.Surface对象不可调用 - pygame.Surface object is not callable 'pygame.Surface'对象不可调用 - 'pygame.Surface' object is not callable
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM