Code: Alles auswählen
import zipfile
zipdatei = zipfile.ZipFile("datei.zip",'r')
bild = PhotoImage( file = zipdatei.read(bild.gif) ) #funktioniert nicht, erwartet eine echte datei
Code: Alles auswählen
import zipfile
zipdatei = zipfile.ZipFile("datei.zip",'r')
bild = PhotoImage( file = zipdatei.read(bild.gif) ) #funktioniert nicht, erwartet eine echte datei
Du müsstest die Bilddaten also noch mit base64 kodieren..python.net hat geschrieben:data (string). Specifies the image data as a string. In standard Tk, this can only be used with GIF files stored in base64 encoding (Tk 4.2 or later).
Code: Alles auswählen
import zipfile
import base64
zipdatei = zipfile.ZipFile("datei.zip",'r')
bild64 = base64.encodestring (zipdatei.read("datei_in_zip"))
bildTk = PhotoImage()
bildTk.put (bild64)