En la primera ejecución me dio un error.
Traceback (most recent call last):
File "/usr/lib/python3.9/tkinter/__init__.py", line 1892, in __call__
return self.func(*args)
File "/home/nitropc/./png.py", line 26, in converter
im = Image.open(image_path)
File "/usr/local/lib/python3.9/dist-packages/PIL/Image.py", line 2974, in open
fp = io.BytesIO(fp.read())
AttributeError: 'str' object has no attribute 'read'
^CTraceback (most recent call last):
File "/home/nitropc/./png.py", line 155, in <module>
root.mainloop()
File "/usr/lib/python3.9/tkinter/__init__.py", line 1429, in mainloop
self.tk.mainloop(n)
El error se debe a que en el metodo
Image.open()
, el argumento sebe ser un string y la variable image_path parece no ser string, así que aconsejo que siempre se convierta en string, auque cuya variable sea string (por si acaso), hazlo con str(image_path), seria
Image.open(str(image_path))
Y aconsejo también que muestra la ruta del archivo png convertido que no especifica en que ruta se almacena.