I'm making a program to print out the color values of pixels in an image and referencing chenlian's answer to a question here to read RGB values. I isolated this part of the program into a different file to test it.
pic = "H://fourpxtest.png"
from tkinter import *
def getRGB(image, x, y):
value = image.get(x, y)
return tuple(map(int, value.split(" ")))
getRGB(pic, 1, 1)
is all i have right now. running this returns
Traceback (most recent call last):
File "H:/tzrtst.py", line 6, in <module>
getRGB(pic, 1, 1)
File "H:/tzrtst.py", line 4, in getRGB
value = image.get(x, y)
AttributeError: 'str' object has no attribute 'get'
What is image
supposed to be exactly? I've tried replacing the words image
with my pic
variable in both spots and pic
with image
but it makes no difference. Can image be a filepath like what I have?