Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import tkinter as tk
from tkinter import ttk
import urllib.request
import json
import schedule, time
def get_luno():
req = urllib.request.urlopen("")
x = json.loads("utf-8"))
return x
def refresh_price():
aLable.configure(text="Ask price: RM " + get_luno()["ask"])
win = tk.Tk()
win.title("Bitcoin price in MYR")
aLable = ttk.Label(win, text="Ask price: RM " + get_luno()["ask"])
aLable.grid(column=0, row=0, padx=8, pady=4)
action = ttk.Button(win, text="Refresh", command=refresh_price)
action.grid(column=0, row=1, padx=8, pady=4)
#while True:
# schedule.run_pending()
# time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment