0

I hope you guys can help me. I've got pictures on my Fileserver, which I want to display in a label. Unfortunately, I always get notifications, that the path doesn‘t exist. That's not true. Is there any other way to download the pictures from the fileserver and to display them in a label. Or could anybody tell me how to alter my code, so it may work?

Thanks <3

root = tk.Tk()

root.configure(background="black")

root.attributes("-fullscreen", True)

with smbclient.open_file(fR"\Server/{picture}", username=username, password=password) as file:
        
  image = ImageTk.PhotoImage(Image.open(file))
    
tk.Label(root, image=image).place(x=0, y=0, anchor=tk.CENTER)

root.mainloop()
  • First try `fr"\\Server\{picure}"`, second `image = ImageTk.PhotoImage(data=file.read())`. – acw1668 Sep 05 '22 at 14:56
  • Thank you very much. Unfortunately, it still doesn't work. I get the following Error Message: TypeError: a bytes-like object is required, not 'str' Traceback (most recent call last): File "/home/pi/.local/lib/python3.9/site-packages/PIL/ImageTk.py", line 146, in __del__ name = self.__photo.name AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo' – PotterParsel Sep 06 '22 at 07:30
  • I think you need to set `mode="rb"` in `smbclient.open_file(...)`. – acw1668 Sep 06 '22 at 07:44
  • It still doesn't work. I get the same Error and response. – PotterParsel Sep 06 '22 at 08:03
  • I don't know why it doesn't work for you. It works for me. May be you add the updated code (better be a [mre]). – acw1668 Sep 06 '22 at 08:06

0 Answers0