0

我正在尝试将图像绘制到画布上(从地方到画布的中间转换)并且出现此错误

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"
4

1 回答 1

3
canvas.create_image(170, space_y[current_space["1a"]], counter1)

您的函数签名似乎有问题。create_image需要一个position元组,加上关键字参数。尝试:

canvas.create_image((170, space_y[current_space["1a"]]), image=counter1)

现在您的应用程序运行没有任何明显的错误。

在此处输入图像描述

于 2015-01-06T18:55:22.663 回答