affichage fenetre tk fonctionnelle

This commit is contained in:
Mylloon 2020-11-30 21:39:25 +01:00
parent bde9dda0de
commit 3ad792c083

View file

@ -36,14 +36,16 @@ class Affichage:
self.notspeaking = "not_speaking.png" self.notspeaking = "not_speaking.png"
def refresh(self): def refresh(self):
self.canvas.config(image = PhotoImage(file = self.get_image())) self.canvas.itemconfig(self.canvas_image, image = PhotoImage(master = self.fenetre, file = self.get_image()))
self.fenetre.update_idletasks() self.fenetre.update_idletasks()
self.fenetre.after(self.buffer, self.refresh) self.fenetre.after(self.buffer, self.refresh)
def get_image(self): def get_image(self):
if Microphone().get_status_speaking(): if Microphone().get_status_speaking():
print("parle")
return self.speaking return self.speaking
else: else:
print("parle pas")
return self.notspeaking return self.notspeaking
def start(self): def start(self):
@ -51,7 +53,7 @@ class Affichage:
self.fenetre.title('Microphone') self.fenetre.title('Microphone')
self.canvas = Canvas(self.fenetre) self.canvas = Canvas(self.fenetre)
self.canvas.configure(width = 1080, height = 2140) self.canvas.configure(width = 1080, height = 2140)
self.canvas.create_image(540, 1070, image = PhotoImage(file = self.get_image())) self.canvas_image = self.canvas.create_image(540, 1070, image = PhotoImage(master = self.fenetre, file = self.get_image()))
self.refresh() self.refresh()