반응형
import requests
response = requests.get(url="http://api.open-notify.org/iss-now.json")
# print(response)
data = response.json()
longitude = data["iss_position"]["longitude"]
latitude = data["iss_position"]["latitude"]
iss_position = (longitude, latitude)
print(iss_position)
from tkinter import *
import requests
def get_quote():
response = requests.get("https://api.kanye.rest")
data = response.json()
quote = data["quote"]
canvas.itemconfig(quote_text, text = quote)
window = Tk()
window.title("Kanye Says...")
window.config(padx=50, pady=50)
canvas = Canvas(width=300, height=414)
background_img = PhotoImage(file="background.png")
canvas.create_image(150, 207, image=background_img)
quote_text = canvas.create_text(150, 207, text="Kanye Quote Goes HERE", width=250, font=("Arial", 30, "bold"), fill="white")
canvas.grid(row=0, column=0)
kanye_img = PhotoImage(file="kanye.png")
kanye_button = Button(image=kanye_img, highlightthickness=0, command=get_quote)
kanye_button.grid(row=1, column=0)
window.mainloop()
반응형
'파이썬 > exercise' 카테고리의 다른 글
[파이썬] 텍스트를 음성파일로 변환 (0) | 2023.01.26 |
---|---|
[파이썬] 숫자 맞추기 게임 (0) | 2023.01.26 |
10-1. python 딕셔너리와 함수 결합 (0) | 2023.01.05 |
9-3. python blind auction (0) | 2023.01.04 |
9-2. python dictionary in list (0) | 2023.01.04 |