D3 #100DaysOfCode Challenge

Day three of my #100DaysOfCode Challenge!

Read Time1 Minute, 25 Seconds

Day Three Progress

So three days in and I’ve pretty much finished working on my Crypto price checker app, I have added another text box so if a ‘GET’ request requires an API key you can add it.

Learnings

Building this app was a great way for me to learn about tkinter and how to create GUI applications in Python, and to be honest it’s pretty easy. I am now planning my next app, I am thinking about making a short adventure game that will require classes and functions. I’m not sure if it will have a GUI, but I’ll make that choice later on.

Here is the final code of my application.

from tkinter import *
import requests
from tkinter import scrolledtext
import requests
from tkinter.ttk import *

#Functions -------
def coincost():
    r = requests.get(f'https://min-api.cryptocompare.com/data/pricemulti?fsyms={combo.get()}&tsyms={combo1.get()}&api_key={apitxt.get()}')
    text = (r.text)
    return text

def clicked():
    lbl.configure(text=coincost())
    lbl2.configure(text="Above is the Price for " + combo.get())


#Title Bar 
window = Tk()
window.title("Techdox Crypto Price Checker")

#Label for coin price
lbl = Label(window, text="")
lbl.grid(column=0, row=2)


# Window Sizing
window.geometry('350x200')
 
#Coin Combo Box
combo = Combobox(window)
combo['values']= ("XRP","BTC","LTC", "XLM" )
combo.current(0) #set the selected item
combo.grid(column=0, row=0)

#Curreny Combo Box
combo1 = Combobox(window)
combo1['values']= ("USD","NZD")
combo1.current(0) #set the selected item
combo1.grid(column=2, row=0)

#Main Button
btn = Button(window, text="Click Me To See Price", command=clicked) 
btn.grid(column=1, row=2)

#Label shows 
lbl2 = Label(window, text="Current Selected")
lbl2.grid(column=1, row=3)

apitxt = Entry(window,width=10)
apitxt.grid(column=1, row=1)


window.mainloop()

0 0
0 %
Happy
0 %
Sad
0 %
Excited
0 %
Angry
0 %
Surprise

Leave a Reply

Your email address will not be published. Required fields are marked *

Close