python报错:argument 1 must be pygame.surface.Surface, not builtin_function_or_method解决方法

这篇具有很好参考价值的文章主要介绍了python报错:argument 1 must be pygame.surface.Surface, not builtin_function_or_method解决方法。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

1、报错分析

python报错:argument 1 must be pygame.surface.Surface, not builtin_function_or_method解决方法,小技巧,pygame,Powered by 金山文档
python报错:argument 1 must be pygame.surface.Surface, not builtin_function_or_method解决方法,小技巧,pygame,Powered by 金山文档

根据报错信息,提示我们出错的原因在与第一个参数类型必须是pygame类型,但是我们的参数类型不匹配。

2、源码分析

python报错:argument 1 must be pygame.surface.Surface, not builtin_function_or_method解决方法,小技巧,pygame,Powered by 金山文档

这里的方法blit()中的第一个参数是STATICSURF,一个全局常量。根据报错我们知道是它出了问题。我们找到这个参数的赋值代码。

3、STATICSURF参数分析

python报错:argument 1 must be pygame.surface.Surface, not builtin_function_or_method解决方法,小技巧,pygame,Powered by 金山文档

这里我们发现STATICSURF被WINSET.copy赋值,这里的WINSET.copy返回的是一个函数对象,但是我们需要的是返回一个Surface窗口对象

4、正确写法

python报错:argument 1 must be pygame.surface.Surface, not builtin_function_or_method解决方法,小技巧,pygame,Powered by 金山文档

将WINSET.copy改成WINSET.copy()使其返回值为Surface对象,就能运行了。文章来源地址https://www.toymoban.com/news/detail-527825.html

到了这里,关于python报错:argument 1 must be pygame.surface.Surface, not builtin_function_or_method解决方法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Java报错:java.lang.IllegalArgumentException: Source must not be null

    运行项目的时候,突然暴了这么一个错,通过debug进行调试以后发现是:  前端传递过来的id不对,后两位自动归0了,通过已经归0的id,显然不可以查询到后端的数据。 经过检查,发现是在使用mybatis-plus的时候,id是使用雪花算法自动生成19位数字,传给前端会通过json序列化

    2024年01月20日
    浏览(44)
  • 【已解决】Flask项目报错TypeError: tuple indices must be integers or slices, not str

    本解决方案适用情境 :在 本地可以正常运行 的flask项目, 放到云服务器报错 TypeError: tuple indices must be integers or slices, not str,即代码本身无误的前提,可能因为环境差异导致的问题。 报错代码 TypeError: tuple indices must be integers or slices, not str 这个错误的意思是元组索引必须是整

    2024年02月17日
    浏览(32)
  • Python错误解决:list indices must be integers or slices, not tuple

    Python错误解决:list indices must be integers or slices, not tuple 在Python编程中,我们经常会遇到代码运行时出现错误的情况。其中,\\\"list indices must be integers or slices, not tuple\\\"是一种常见的错误类型。它通常发生在使用列表时,我们将元组作为索引值传递给列表时会出现这个错误。 该错

    2024年02月11日
    浏览(31)
  • 【Python】成功解决TypeError: list indices must be integers or slices, not float

    【Python】成功解决TypeError: list indices must be integers or slices, not float 🌈 个人主页:高斯小哥 🔥 高质量专栏:Matplotlib之旅:零基础精通数据可视化、Python基础【高质量合集】、PyTorch零基础入门教程👈 希望得到您的订阅和支持~ 💡 创作高质量博文(平均质量分92+),分享更多关

    2024年04月27日
    浏览(50)
  • Vue CLI系列之Syntax Error: Thread Loader (Worker 4) The “from“ argument must be of type string. Receive

    Syntax Error: Thread Loader (Worker 4) The “from” argument must be of type string. Received undefined vue-cli 使用 wokrer-loader 加载 web woker 时,使用 npm run build 有很大机率会打包失败,报错如上。 thread-loader 与worker-loader有冲突。 vue.config.js 配置 parallel: false 。构建正式环境关闭thread-loader。 如果你感

    2024年02月15日
    浏览(36)
  • 微软Surface/Surface pro笔记本电脑进入bios界面

    微软Surface笔记本电脑进入bios界面 方法一推薦這種方法:Surface laptop 进BIOS步骤 开机后,不停按音量键进bios界面。 方法二:Surface Book、Surface Pro进bios步骤 1、关闭Surface,然后等待大约10秒钟以确保其处于关闭状态。 2、 長按 住Surface上的调高音量按钮(音量+),同时 按下 并 释

    2024年02月04日
    浏览(38)
  • 【Python】Pandas Excel file format cannot be determined, you must specify an engine manually.报错【已解决】

    根据Python官网,Python3.7还支持WIN7。 项目对应的requirements.txt为: 项目对应的nuitka命令为: 报错主要是PySide6与matplotlib之间接口兼容性的问题。报错位置代码 根据gpt, 根据matplotlib官方issues,解决方案是, mpl 升级到 =3.6.2 或将 pyside 降级到 6.4.0 Python3.7下matplotlib,最高支持3.5,

    2024年02月12日
    浏览(38)
  • 微软Surface Book 2终止更新日前推迟,将与Surface Pro 6同日结束服务

    近日有消息称,微软公布了旗下Surface系列设备的更新支持终止日期,并且包括新发布的设备和前代产品。 早在本月23日,微软就为Surface Book 2推送了新的固件,主要提升了Surface Dock 2的稳定性,及其他一些安全更新。 而此次微软延长了Surface Book 2的更新支持终止日期,到今年

    2024年02月12日
    浏览(33)
  • python selenium报错ValueError: Timeout value connect was <...>, but it must be an int, float or None.

    因更换系统,重新安装了selenium。命令:pip install selenium 默认版本为selenium4,版本不太兼容,所以卸载:pip uninstall selenium 更换为旧版本:pip install selenium==3.141.0 安装完以后显示: Successfully installed selenium-3.141.0 urllib3-2.0.2(坑出现了) 运行一下代码以后报错: 报错: ValueErr

    2024年02月12日
    浏览(30)
  • java.lang.IllegalArgumentException: Source must not be null

    这个错的意思是:报这个错是因为在cope的时候参数为空 这种情况下已经都做了非空判断但是还依然会报错,是因为自己虽然查出来的数据为null,但是只要重新new一下就可以

    2024年02月13日
    浏览(38)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包