今天,运行代码出现了一个这样的TypeError: destroyWindow() missing required argument 'winname' (pos 1)错误,从字面的意思看,是destroyWindow()函数缺少必要的’winname’参数。其实就是最后,下面代码最后一行中括号,缺少毁掉窗口的名称。

import cv2 as cv
from PIL import Image
import numpy as npimage = Image.open('liuyifei.jpg')img_crop = image.crop((460, 460, 920, 920))img = np.array(img_crop)
cv.imshow('img_crop', img)cv.waitKey(10000)
cv.destroyWindow()

报错:

D:\anaconda\python.exe "D:/my test project/blur_7.23/test_8.19/imageCopy.py"
Traceback (most recent call last):File "D:/my test project/blur_7.23/test_8.19/imageCopy.py", line 20, in <module>cv.destroyWindow()
TypeError: destroyWindow() missing required argument 'winname' (pos 1)

修改后:

cv.waitKey(10000)
cv.destroyWindow('img_crop')

代码正确运行,结果如下:

D:\anaconda\python.exe "D:/my test project/blur_7.23/test_8.19/imageCopy.py"Process finished with exit code 0

错误处理:TypeError: destroyWindow() missing required argument ‘winname‘ (pos 1)的详细讲解相关推荐

  1. TypeError: to_bytes() missing required argument ‘byteorder‘ (pos 2)

    这个错误是使用 to_bytes() 忘记添加了指定大端或者小端的类型了 下面的就会报错 a = 1000 print(a.to_bytes(2)) 具体做法如下 a = 1000 print(a.t ...

  2. 【Debug】OpenCV_Python:imshow() error “TypeError: Required argument 'mat' (pos 2) not found”

    源码: cv2.imshow(gray_scale) 报错: TypeError: Required argument 'mat' (pos 2) not found 原因: cv2.imshow() ...

  3. TypeError: __init__() missing 1 required positional argument: 'on_delete' 解决办法

    Django 中创建Model时报以下错误: TypeError: init() missing 1 required positional argument: 'on_delete' 代码如下: f ...

  4. 解决TypeError: get() missing 1 required positional argument: 'url'

    使用selenium时需要确保电脑上已经下载了浏览器对应版本的webdriver 先附初始代码 #导入库 from selenium import webdriver #声明浏览器对象并调用 brow ...

  5. TypeError: func() missing 1 required positional argument: 'XXXXX' 报错原因

    在面向对象编程的时候会报这样的错误: TypeError: func() missing 1 required positional argument: 'XXXXX' 报这个错误有两种原因: 1.实 ...

  6. TypeError: bar() missing 1 required positional argument: ‘x‘

    运行代码时,出现错误:TypeError: bar() missing 1 required positional argument: 'x'如何解决呢? 意思是:bar()缺少1个必需的位置参数:& ...

  7. Django - TypeError: __init__() missing 1 required positional argument: ‘on_delete‘ 的解决办法

    Django 中创建Model时报以下错误: TypeError: init() missing 1 required positional argument: 'on_delete' 代码如下: f ...

  8. Python程序运行出现TypeError: run() missing 1 required positional argument: ‘test’

    TypeError: run() missing 1 required positional argument: 'test' 文章目录 源代码 错误类型 解决办法 源代码 import unitte ...

  9. 关于错误TypeError: get_biff_record() missing 1 required positional argument: ‘self‘的解决

    在进行python实现Excel自动化的过程中出现了TypeError: get_biff_record() missing 1 required positional argument: 'self ...

最新文章

  1. Linux的su命令,sudo命令和限制root远程登录
  2. python怎么画形状_python – matplotlib – 如何绘制随机导向的矩形(或任何形状)?...
  3. android-学习1 配置环境
  4. 团队每日冲刺博客05
  5. 冲上热搜!8次手术没有倒下,截肢少年考出684分!清华发声
  6. 【译】2019年开始使用Typescript
  7. C#写字板问题一二 —— C#+WinForm编程趣味入门实战-天轰穿.NET4趣味编程视频教程...
  8. [CC-CHEFINV]Chef and Swaps
  9. 在Python里安装Jieba中文分词组件
  10. [BZOJ3717] [PA2014] Pakowanie [状态压缩][dp]
  11. 量化视角下的基金定投策略
  12. Linux中修改HTTP默认主页
  13. Spring 全家桶,永远滴神
  14. 系统出现“预体验成员内版本遇到 问题”错误的处理(亲身经历)
  15. 红米手机4android os是木马怎么清除,红米Note4 的LineageOS14.1刷机包 安卓7.1.1原生风格 本地化 20180203更新...
  16. Resharper使用
  17. DSP TMS320F28377D与TMS320F28335硬件资源对比
  18. can转光纤 can光端机 总线式CAN光纤转换器用于消防主机长距离互联
  19. Mozilla 正在火狐中集成谷歌翻译;内存产能增长减缓,基本告别降价
  20. 透视变换 c++实现

热门文章

  1. PFC2D学习笔记——颗粒生成
  2. php添加购物车模板,php购物车程序
  3. 用 PyPy 让你的 Python 代码运行得更快!
  4. pta 藏头诗(C语言实现)
  5. 腾讯云分布式数据库技术分享
  6. 淘宝历史价格查询php源码,记录历史采购价并在列表中显示最低价
  7. 少儿C++快乐编程网络教程
  8. openssl漏洞检查修复
  9. uniapp + vue 定位聊天最新消息 实现滚动条一直在元素的最底部
  10. 界面的设计原则有哪些,你知道么?