Code: Alles auswählen
def __init__(self,friendname):
#master4 = Tk(screenName="Profil",className="Profil: "+friendname)
Toplevel.__init__(self)
self.title("Profil: "+friendname)
self.attributes("-alpha",0.8)
self.geometry("800x500")
self.iconbitmap('msgico.ico')
self.config(bg="#000000",)
conn = MySQLdb.connect (host = "localhost",
user = "root",
passwd = "",
db = "armyofdragon")
cursor = conn.cursor ()
sql="SELECT firstname, lastname, website, location, occupation, interests, company, address, city, state, phone, fax FROM jos_users, jos_comprofiler WHERE jos_users.id = user_id AND username = '" + friendname + "';"
sql2="Select avatar from jos_users,jos_comprofiler WHERE jos_users.id=user_id AND username='" + friendname + "';"
cursor.execute (sql)
profil = cursor.fetchone ()
header = tkFont.Font ( size="48")
cursor.execute (sql2)
ava1 = cursor.fetchone ()
if ava1[0] is None :
urlString = "http://www.armyofdragon.de/images/messenger/noavamsg.png"
bild = "noavamsg.png"
else:
urlString = "http://www.armyofdragon.de/images/comprofiler/"+str(ava1[0])
bild = str(ava1[0])
imgStream = urllib.urlretrieve(urlString,"images\\"+bild)
rechts = Frame(self,bg="#000000")
rechts.pack(anchor=E,fill=BOTH,side=RIGHT,expand=YES)
links = Frame(self,bg="#000000")
links.pack(anchor=W,fill=BOTH,expand=YES)
self.labelprofilname = Label(links ,font=header,bg="#000000",fg="#FF0000", text=friendname)
self.labelprofilname.pack(anchor=N)
Avatar = Imageload.PhotoImage(IMG.open("images\\"+bild).resize((80,80)),master=self)
self.avatarprofil = Label (rechts,text="AVA",image=Avatar).pack(anchor=N)
self.label1= Label(links , text="Vorname: ",bg="#000000",fg="#FF0000").pack(anchor=W)
self.text1= Label(links , text=profil[0],bg="#000000",fg="#FF0000").pack(anchor=W)
self.label2= Label(links , text="Nachname: ",bg="#000000",fg="#FF0000").pack(anchor=W)
self.text2= Label(links , text=profil[1],bg="#000000",fg="#FF0000").pack(anchor=W)
self.label3= Label(rechts , text="Website: ",bg="#000000",fg="#FF0000").pack(anchor=W)
self.text3= Label(rechts , text=profil[2],bg="#000000",fg="#FF0000").pack(anchor=W)
self.label4= Label(links , text="Lokation: ",bg="#000000",fg="#FF0000").pack(anchor=W)
self.text4= Label(links , text=profil[3],bg="#000000",fg="#FF0000").pack(anchor=W)
self.label5= Label(rechts , text="Beruf: ",bg="#000000",fg="#FF0000").pack(anchor=W)
self.text5= Label(rechts , text=profil[4],bg="#000000",fg="#FF0000").pack(anchor=W)
self.label7= Label(rechts , text="Firma: ",bg="#000000",fg="#FF0000").pack(anchor=W)
self.text7= Label(rechts , text=profil[6],bg="#000000",fg="#FF0000").pack(anchor=W)
self.label8= Label(links , text="Adresse: ",bg="#000000",fg="#FF0000").pack(anchor=W)
self.text8= Label(links , text=profil[7],bg="#000000",fg="#FF0000").pack(anchor=W)
self.label9= Label(links , text="Stadt: ",bg="#000000",fg="#FF0000").pack(anchor=W)
self.text9= Label(links , text=profil[8],bg="#000000",fg="#FF0000").pack(anchor=W)
self.label10= Label(links, text="Kreis: ",bg="#000000",fg="#FF0000").pack(anchor=W)
self.text10= Label(links , text=profil[9],bg="#000000",fg="#FF0000").pack(anchor=W)
self.label11= Label(rechts , text="Telefonnr: ",bg="#000000",fg="#FF0000").pack(anchor=W)
self.text11= Label(rechts , text=profil[10],bg="#000000",fg="#FF0000").pack(anchor=W)
self.label12= Label(rechts , text="FAX: ",bg="#000000",fg="#FF0000").pack(anchor=W)
self.text12= Label(rechts , text=profil[11],bg="#000000",fg="#FF0000").pack(anchor=W)
self.label6= Label(links , text="Interessen: ",bg="#000000",fg="#FF0000").pack(anchor=W)
self.interessen = Text (links,height="5",bg="#020202",fg="#FF0000")
self.interessen.pack()
self.interessen.insert(END,profil[5])
# Verhindern das die Ausgabe manipulierbar ist
self.interessen.unbind_class("Text", "<Return>")
self.interessen.unbind_class("Text", "<Any-KeyPress>")
self.interessen.unbind_class("Text", "<Any-KeyRelease>")
self.mainloop() #ENDE Profil
Ok es liegt am mainloop aber dann hab ich das problem , dass das Ava nichtmehr angezeigt wird sondern nurnoch ein weisser kasten... wie kann ich dass dann beheben?