Python 3.x PhotoImage.zoom()错误

Python 3.x PhotoImage.zoom()错误,python-3.x,tkinter,Python 3.x,Tkinter,我目前正在开发一个应用程序,它从.txt文件中读取强度,然后在将强度映射到图像之前将其转换为RGB。现在,我正在创建一个空的tkinter.PhotoImage对象,然后用RGB数据填充像素。到目前为止,它工作正常,但当我尝试使用PhotoImage.zoom()函数缩放图像以适应画布时,我得到: >>>resizedImage = image.zoom(30) Traceback (most recent call last): File "<pyshell#15>

我目前正在开发一个应用程序,它从.txt文件中读取强度,然后在将强度映射到图像之前将其转换为RGB。现在,我正在创建一个空的tkinter.PhotoImage对象,然后用RGB数据填充像素。到目前为止,它工作正常,但当我尝试使用PhotoImage.zoom()函数缩放图像以适应画布时,我得到:

>>>resizedImage = image.zoom(30)
Traceback (most recent call last):
File "<pyshell#15>", line 1, in <module>
rIm = im.zoom(30)
File "C:\Python32\lib\tkinter\__init__.py", line 3249, in zoom
self.tk.call(destImage, 'copy', self.name, '-zoom',x,y)
_tkinter.TclError: invalid command name "pyimage4"

如果您发布了一些您怀疑是导致此错误的代码,这可能会有所帮助。我已编辑了原始代码以包含图像创建代码。@Justin我与您有相同的错误。你找到解决办法了吗?
def drawImage(filename, xPoints, yPoints, measurement, max, min):
xPosition = xPoints
yPosition = yPoints
im = PhotoImage(width = xPoints, height = yPoints)
for i in range(1, xPoints * yPoints + 1):

    tmp = linecache.getline(filename +'_raw_' + str(i) + '.txt', measurement)
    if eval(tmp[0:5]) < 100:
        wavelength = eval(tmp[0:5])
        intensity = eval(tmp[9:])
    elif eval(tmp[0:5]) >= 100 and eval(tmp[0:5]) < 1000:
        wavelength = eval(tmp[0:6])
        intensity = eval(tmp[10:])
    elif eval(tmp[0:5]) >= 1000:
        wavelength = eval(tmp[0:7])
        intensity = eval(tmp[11:])

    RGB = wav2RGB(wavadjust(intensity, max, min))

    im.put(RGB, (xPosition -1, yPosition - 1))
    xPosition -= 1
    if xPosition == 0:
        xPosition = xPoints
        yPosition -= 1
return im
image = drawImage(filename, xPoints, yPoints, initMeasurement, max, min)
resizedImage = image.zoom(30)