daily pastebin goal
70%
SHARE
TWEET

Untitled

a guest Mar 23rd, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from tkinter import *
  2. import requests
  3. from bs4 import BeautifulSoup
  4. from datetime import datetime
  5.  
  6. url = "http://www.cbr.ru/scripts/XML_daily.asp"
  7.  
  8. response = requests.get(url).content
  9.  
  10. xml = BeautifulSoup(response, "lxml")
  11.  
  12. def get_course(id):
  13.     return xml.find("valute", {"id": id}).value.text
  14.  
  15. window = Tk()
  16. window.title("Курс валют")
  17. window.geometry("400x350")
  18.  
  19. img = PhotoImage(file="logo.png")
  20. logo = Label(window, image=img)
  21. logo.place(x=0, y=0)
  22.  
  23. label = Label(text="Курс валют")
  24. label.place(x=150, y=25)
  25.  
  26. usd_label = Label(text="$" + get_course("R01235"))
  27. usd_label.place(x=190, y=100)
  28.  
  29. window.mainloop()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top