Skip to content

Instantly share code, notes, and snippets.

@amirulabu
Created July 25, 2017 16:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amirulabu/7555f19a7f83458840223a7246699604 to your computer and use it in GitHub Desktop.
Save amirulabu/7555f19a7f83458840223a7246699604 to your computer and use it in GitHub Desktop.
import tkinter as tk
from tkinter import ttk
import urllib.request
import json
import schedule, time
def get_luno():
req = urllib.request.urlopen("https://api.mybitx.com/api/1/ticker?pair=XBTMYR")
x = json.loads(req.read().decode("utf-8"))
req.close()
return x
def refresh_price():
aLable.configure(text="Ask price: RM " + get_luno()["ask"])
#print(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)
#schedule.every(1).minutes.do(refresh_price)
win.mainloop()
#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