'How to save a tkinter photoimage in folder?
Trying to save the image in my specified directory but it is displaying error that type is not str
image.save()
Solution 1:[1]
Assuming you are trying to save an image to a file, from a tk.PhotoImage.
Solution
save() is not a method of PhotoImage class. You will have to use write() instead.
PhotoImage.write Write image to file FILENAME in FORMAT starting from position FROM_COORDS. Read here
Example
# try not to import globally
import tkinter as tk
ws = tk.Tk()
a = tk.PhotoImage(file='logo.png')
a.write('sample.png')
ws.mainloop()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Billy |
