TypeError: playMovVideos() takes exactly 2 arument but 3 to given的解决方法
来源:互联网 发布:淘宝手机端全屏怎么做 编辑:程序博客网 时间:2024/06/09 17:55
自己再类里定义了个函数,用来播放视频
最后这样问题就成功解决了。
def playMovVideos(self, mov): import os os.system('start "rv.exe" "%s"'%mov)
在将这个函数个QtCore链接起来的时候就老报题目的这个错,自己苦想很久不得其解,最后在网上反倒一篇文章,才解开我的疑惑。
self.connect(self._videoNameActon, QtCore.SIGNAL('triggered(bool)'), functools.partial(self.playMovVideos, item))用functools偏函数,将item传进去函数里,表面上看是传入一个参数,和函数定义的时候是一致的,但在做链接的时候实际上还传进去一个event参数,就是时间参数了,
所有就会报题目的那个错,需要修改下函数才行
<pre name="code" class="python">def playMovVideos(self, mov, event): import os os.system('start "rv.exe" "%s"'%mov)改成这样就好了,形参和实参想统一了,这里还有个注意点就是,“mov”和“event”这两个参数也不能位置互换,互换仍然出错。
最后这样问题就成功解决了。
0 0
- TypeError: playMovVideos() takes exactly 2 arument but 3 to given的解决方法
- TypeError: print_space() takes exactly 2 arguments (3 given)
- TypeError: distinct() takes exactly 2 arguments (3 given)
- TypeError: __init__() takes exactly 2 arguments (3 given)
- PAMIE TypeError: getElementsByTagName() takes exactly 1 positional argument (2 given)
- TypeError: checkcode() takes exactly 1 argument (2 given)
- Python: TypeError: XXX() takes exactly 1 argument (2 given)
- django中报错TypeError: su() takes exactly 1 argument (2 given)的解决办法
- PamIE 和COM调用IE出错: TypeError: getElementById() takes exactly 1 argument (2 given)
- TypeError: __init__() takes exactly 2 arguments (1 given)(已解决)
- #Tensorflow# TypeError: set_shape() takes 1 positional argument but 2 were given
- Python 'takes exactly 1 argument (2 given)' Python error
- Python 'takes exactly 1 argument (2 given)' Python error
- 在调用外部.py文件class内的函数出现takes exactly 1 argument (2 given)解决方案
- TypeError: resize_images() takes at least 3 arguments (3 given)
- TypeError: add_or_update() takes at most 3 arguments (4 given)
- python MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker") TypeError: __call__() takes exactly 2
- python安装某模块时出现 TypeError: __call__() takes exactly
- Android 基于MVC的MVVM模式开发
- 大帅的有道云笔记
- 大二下学期计算机主导课程概述
- 创业板VOL-MY 10点研究
- 微软研究院Detour开发包之API拦截技术
- TypeError: playMovVideos() takes exactly 2 arument but 3 to given的解决方法
- EEROR: "***" [***.ko] undefined! 的错误原因和解决办法
- “ 智慧的都是简单的” ——中国人的四大传统智慧
- 计算ListView高度
- Sales Engineer
- 校园招聘会调查报告
- CBIR: Indexing and Retrieval--基于内容的图像检索:索引和检索
- C语言学习笔记----伊能C语言学习笔记-----函数的副本机制
- ORA-01033 : ORACLE initialization or shutdown in progress