Skip to content

Commit

Permalink
feat Python Python Tkinter Bitcoin Price Web Scraper With BeautifulSo…
Browse files Browse the repository at this point in the history
…ul complete

Python Python Tkinter Bitcoin Price Web Scraper With BeautifulSou complete

Resolves: #
See Also: #
  • Loading branch information
brian-emarquez committed Jan 20, 2021
1 parent 53252ef commit d36f947
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ def Update():
page = urllib.request.urlopen("https://www.coindesk.com/price/bitcoin").read()
html = BeautifulSoup(page, 'html.parser')
price_large = html.find(class_="price-large")
print(price_large)
#print(price_large)
# convert to string so we can slice
price_large1 = str(price_large)

@@ -71,6 +71,9 @@ def Update():
now = datetime.now()
current_time = now.strftime("%I:%M:%S %p")

#Update the status bar
status_bar.config(text=f'Last Update: {current_time} ')

# Determine Price Change
# grab current Prince
current = price_large2
@@ -80,8 +83,15 @@ def Update():

if previous:
if float(previous) > float (current):
latest_price.config(text=f'Price Down'{float(previous)}, fg="grey")
latest_price.config(
text=f'Price Down{round(float(previous)-float(current),2)}', fg="red")

elif float(previous) == float(current):
latest_price.config(text="Price Unchange", fg="grey")

else:
latest_price.config(
text=f'Price Up {round(float(current)-float(previous),2)}', fg="gren")

else:
previous = current

0 comments on commit d36f947

Please sign in to comment.