我正在尝试将图像绘制到画布上(从地方到画布的中间转换)并出现此错误
包含代码的hastebin: http://hastebin.com/tuciyisisa.py
Traceback (most recent call last):
File "D:\Stuff\python\Coursework\AQADo\main.py", line 82, in <module>
app = Application(master=root)
File "D:\Stuff\python\Coursework\AQADo\main.py", line 74, in __init__
self.drawCounter(space_y, current_space, game_canvas)
File "D:\Stuff\python\Coursework\AQADo\main.py", line 26, in drawCounter
canvas.create_image(170, space_y[current_space["1a"]], counter1)
File "C:\Python34\lib\tkinter\__init__.py", line 2291, in create_image
return self._create('image', args, kw)
File "C:\Python34\lib\tkinter\__init__.py", line 2282, in _create
*(args + self._options(cnf, kw))))
_tkinter.TclError: unknown option "pyimage2"
答案 0 :(得分:2)
canvas.create_image(170, space_y[current_space["1a"]], counter1)
这里的功能签名似乎有问题。 create_image
期望position
元组加上关键字参数。尝试:
canvas.create_image((170, space_y[current_space["1a"]]), image=counter1)
现在您的应用程序运行时没有任何明显的错误。