small improvements to make textbox non-editable
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 94 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 41 KiB |
+8
-10
@@ -9,21 +9,19 @@ import urllib
|
||||
|
||||
class RadioParadise(object):
|
||||
def __init__(self):
|
||||
rp_dict=self.load_api()
|
||||
self.load_api()
|
||||
|
||||
def load_api(self):
|
||||
respons=requests.get("https://api.radioparadise.com/api/now_playing")
|
||||
rp_dict=respons.json()
|
||||
self.title=rp_dict["title"]
|
||||
self.artist=rp_dict["artist"]
|
||||
self.album=rp_dict["album"]
|
||||
self.year=rp_dict["year"]
|
||||
self.time=rp_dict["time"]
|
||||
self.jpg_path=rp_dict["cover"]
|
||||
print(self.album)
|
||||
|
||||
def load_api(self):
|
||||
respons=requests.get("https://api.radioparadise.com/api/now_playing")
|
||||
rp_dict=respons.json()
|
||||
return rp_dict
|
||||
|
||||
|
||||
def get_list(self):
|
||||
result=(self.title, self.artist, self.album, self.year, self.time)
|
||||
return result
|
||||
@@ -58,21 +56,21 @@ class RPViewer(Tk):
|
||||
self.font=Font(family="Arial", size=14)
|
||||
self.textbox=Text(self, height=6, width=50, font=self.font)
|
||||
self.textbox.insert("1.0", self.rp.get_list())
|
||||
self.textbox.config(state=DISABLED)
|
||||
self.textbox.pack()
|
||||
|
||||
def quit(self):
|
||||
exit()
|
||||
|
||||
def refresh_textbox(self):
|
||||
self.textbox.config(state=NORMAL)
|
||||
self.textbox.delete("1.0", "end")
|
||||
self.textbox.insert("1.0", self.rp.get_list())
|
||||
self.textbox.config(state=DISABLED)
|
||||
|
||||
|
||||
def main():
|
||||
rp_play=RadioParadise()
|
||||
print (rp_play.title)
|
||||
print(rp_play.artist)
|
||||
print (rp_play.time)
|
||||
app=RPViewer(rp_play)
|
||||
app.mainloop()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user