ich versteh grad nix mehr.
hier:
Code: Alles auswählen
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Tkinter
from Tkinter import *
import PIL
from PIL import ImageTk, Image
#baseheight = 75
#img = Image.open('C:\\Users\\DMD-OL\\Desktop\\qrcode.png')
#hpercent = (baseheight / float(img.size[1]))
#wsize = int((float(img.size[0]) * float(hpercent)))
#img = img.resize((wsize, baseheight), PIL.Image.ANTIALIAS)
#img.save('C:\\Users\\DMD-OL\\Desktop\\resized_image.png')
imp_fenster = Tkinter.Tk()
imp_fenster.geometry('380x150+1200+673')
im = PIL.Image.open("C:\\Users\\DMD-OL\\Desktop\\resized_image.png")
photo = PIL.ImageTk.PhotoImage(im)
w = Label(imp_fenster, image=photo)
w.place(x=50,y=35)
text = Label(imp_fenster,text=("Hallo, hier steht ein Text."),font=('Arial', 8, 'bold'), height=10, width=25, fg="#000000000",justify='left')
text.place(x=150,y=0)
imp_fenster.mainloop()
wenn ich aber dieses habe:
Code: Alles auswählen
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Tkinter
from Tkinter import *
import PIL
from PIL import ImageTk, Image
backwin = Tkinter.Tk()
backwin.geometry('680x650+500+73')
backwin.configure(background='black')
def impressum(b3):
b3.destroy()
imp_fenster = Tkinter.Toplevel(backwin)
imp_fenster.geometry('380x150+1200+673')
im = PIL.Image.open("C:\\Users\\DMD-OL\\Desktop\\resized_image.png")
photo = PIL.ImageTk.PhotoImage(im)
w = Label(imp_fenster, image=photo)
w.place(x=50,y=35)
text = Label(imp_fenster,text=("Hallo, hier steht ein Text."),font=('Arial', 8, 'bold'), height=10, width=25, fg="#000000000",justify='left')
text.place(x=150,y=0)
def impressum_schliessen(b3):
imp_fenster.destroy()
b3 = Tkinter.Button(backwin, text=("Click mich nochmal...:)"), font=('Arial', 8, 'bold'), height=2, width=25, relief="raised", borderwidth=2, fg='#000000000', justify='center',command=lambda: impressum(b3))
b3.place(relx=.88, rely=.97, anchor="c")
b_imp1 = Tkinter.Button(imp_fenster, text=("Schließen"), font=('Arial', 8, 'bold'), width=15, relief="raised", borderwidth=2, fg='#000000000', justify='center',command=lambda: impressum_schliessen(b3))
b_imp1.place(relx=.5, rely=.8, anchor="c")
b3 = Tkinter.Button(backwin, text=("Click mich"), font=('Arial', 8, 'bold'), height=2, width=25, relief="raised", borderwidth=2, fg='#000000000', justify='center',command=lambda: impressum(b3))
b3.place(relx=.88, rely=.97, anchor="c")
backwin.mainloop()
text = Label(imp_fenster,text=("Hallo, hier steht ein Text."),font=('Arial', 8, 'bold'), height=10, width=25, fg="#000000000",justify='left')
einfach einen kleinen fehler einbaue:
textd = Label(imp_fenster,text=("Hallo, hier steht ein Text."),font=('Arial', 8, 'bold'), height=10, width=25, fg="#000000000",justify='left')
wird das Bild (ich hab einfach einen QR-Code genommen) natürlich mit einer kleinen fehlermeldung angezeigt!
woran liegt das denn??