Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python _tkinter.TclError:未知选项“;pyimage2“;_Python_Tkinter_Tkinter Canvas - Fatal编程技术网

Python _tkinter.TclError:未知选项“;pyimage2“;

Python _tkinter.TclError:未知选项“;pyimage2“;,python,tkinter,tkinter-canvas,Python,Tkinter,Tkinter Canvas,我试图在画布上绘制图像(从位置到画布的转换过程中),出现此错误 hastebin包含代码: 回溯(最近一次呼叫最后一次): 文件“D:\Stuff\python\Coursework\AQADo\main.py”,第82行,在 应用程序=应用程序(主程序=根) 文件“D:\Stuff\python\Coursework\AQADo\main.py”,第74行,在\uuu init中__ self.drawCounter(空间、当前空间、游戏画布) 文件“D:\Stuff\python\Cour

我试图在画布上绘制图像(从位置到画布的转换过程中),出现此错误

hastebin包含代码:

回溯(最近一次呼叫最后一次):
文件“D:\Stuff\python\Coursework\AQADo\main.py”,第82行,在
应用程序=应用程序(主程序=根)
文件“D:\Stuff\python\Coursework\AQADo\main.py”,第74行,在\uuu init中__
self.drawCounter(空间、当前空间、游戏画布)
文件“D:\Stuff\python\Coursework\AQADo\main.py”,第26行,在drawCounter中
画布。创建图像(170,空格y[当前空格[“1a”]],计数器1)
文件“C:\Python34\lib\tkinter\\uuuu init\uuuuu.py”,第2291行,在create\u image中
返回自我。\u创建('image',args,kw)
文件“C:\Python34\lib\tkinter\\ uuuuu init\uuuuuu.py”,第2282行,在\u create中
*(参数+自选项(cnf,kw)))
_tkinter.TclError:未知选项“pyimage2”
这里的函数签名似乎有问题。需要一个
位置
元组,加上关键字参数。尝试:

canvas.create_image((170, space_y[current_space["1a"]]), image=counter1)
现在,您的应用程序运行时没有任何明显的错误


将其替换为线条
画布。创建_图像((90,空格y[当前_空格[“1a”]),image=counter1)
并且它没有绘制,但没有错误似乎是背景图像的一个问题,不管背景图像多么奇怪,在我的机器上工作。您使用的是什么版本的Python?您使用的是什么操作系统?您正在使用IDE吗?您正在从命令行运行脚本吗?你要把它粘贴到?看我的编辑,这是我的错。谢谢再次编辑:似乎它没有将其绘制到我使用的
canvas屏幕上。创建图像((90,空格y[当前空格[“1a”]),图像=计数器1,锚定=NW)
canvas.create_image(170, space_y[current_space["1a"]], counter1)
canvas.create_image((170, space_y[current_space["1a"]]), image=counter1)