Formatting string in textbox from class RadioParadise

This commit is contained in:
2023-12-30 11:07:20 +01:00
parent 45f0a3cfeb
commit 19efe3984c
+4 -4
View File
@@ -22,8 +22,8 @@ class RadioParadise(object):
self.jpg_path=rp_dict["cover"] self.jpg_path=rp_dict["cover"]
return rp_dict return rp_dict
def get_list(self): def get_fmt_list(self):
result=(self.title, self.artist, self.album, self.year, self.time) result=(f'Titel: {self.title}\nArtiest: {self.artist}\nAlbum: {self.album}\nJaar: {self.year}\nTijd: {self.time}')
return result return result
class AlbumCover(RadioParadise): class AlbumCover(RadioParadise):
@@ -55,7 +55,7 @@ class RPViewer(Tk):
self.button_refresh.pack(side=TOP) self.button_refresh.pack(side=TOP)
self.font=Font(family="Arial", size=14) self.font=Font(family="Arial", size=14)
self.textbox=Text(self, height=6, width=50, font=self.font) self.textbox=Text(self, height=6, width=50, font=self.font)
self.textbox.insert("1.0", self.rp.get_list()) self.textbox.insert("1.0", self.rp.get_fmt_list())
self.textbox.config(state=DISABLED) self.textbox.config(state=DISABLED)
self.textbox.pack() self.textbox.pack()
@@ -65,7 +65,7 @@ class RPViewer(Tk):
def refresh_textbox(self): def refresh_textbox(self):
self.textbox.config(state=NORMAL) self.textbox.config(state=NORMAL)
self.textbox.delete("1.0", "end") self.textbox.delete("1.0", "end")
self.textbox.insert("1.0", self.rp.get_list()) self.textbox.insert("1.0", self.rp.get_fmt_list())
self.textbox.config(state=DISABLED) self.textbox.config(state=DISABLED)