creation class label image
This commit is contained in:
parent
3ea7891753
commit
05362a9d9c
20
chaineTV.py
20
chaineTV.py
@ -22,6 +22,15 @@ class Labbelink (Label):
|
|||||||
def _openlink(self,evt):
|
def _openlink(self,evt):
|
||||||
webbrowser.open(self.link)
|
webbrowser.open(self.link)
|
||||||
|
|
||||||
|
class LabelImage(Label):
|
||||||
|
|
||||||
|
def __init__(self,parent,url):
|
||||||
|
raw_data = urllib.request.urlopen(url).read()
|
||||||
|
image = ImageTk.PhotoImage(file=io.BytesIO(raw_data))
|
||||||
|
Label.__init__(self,parent,image=image)
|
||||||
|
self.image = image
|
||||||
|
|
||||||
|
|
||||||
class Interface:
|
class Interface:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -74,11 +83,12 @@ class Interface:
|
|||||||
if emision == "can't find show":
|
if emision == "can't find show":
|
||||||
Label(self.resultframe,text="impssible de parser cette chaine").pack()
|
Label(self.resultframe,text="impssible de parser cette chaine").pack()
|
||||||
else:
|
else:
|
||||||
raw_data = urllib.request.urlopen(emision['img']).read()
|
#raw_data = urllib.request.urlopen(emision['img']).read()
|
||||||
image = ImageTk.PhotoImage(file=io.BytesIO(raw_data))
|
#image = ImageTk.PhotoImage(file=io.BytesIO(raw_data))
|
||||||
photolabel=Label(self.resultframe,image=image)
|
#photolabel=Label(self.resultframe,image=image)
|
||||||
photolabel.image = image
|
#photolabel.image = image
|
||||||
photolabel.pack()
|
image=LabelImage(self.resultframe,emision['img'])
|
||||||
|
image.pack()
|
||||||
Labbelink(self.resultframe,("emmision ce soir: "+emision["title"]),emision['href']).pack()
|
Labbelink(self.resultframe,("emmision ce soir: "+emision["title"]),emision['href']).pack()
|
||||||
if len(emision['casting']) > 0:
|
if len(emision['casting']) > 0:
|
||||||
Label(self.resultframe,text="réalisateur: "+emision['casting'][0]).pack()
|
Label(self.resultframe,text="réalisateur: "+emision['casting'][0]).pack()
|
||||||
|
Loading…
Reference in New Issue
Block a user