왜 칸예 명언을 출력하는 API 가 있는지 모르겠다.
kanye.rest
A free REST API for random Kanye West quotes
kanye.rest
😎 코드
from tkinter import *
import requests
def get_quote():
response =requests.get("https://api.kanye.rest")
response.raise_for_status()
result = response.json()["quote"]
canvas.itemconfig(quote_text, text = result)
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()
😎 출력

솔직히 저 흰 색깔 거슬렸는데
거슬림 < 귀찮음
'Python 🎧' 카테고리의 다른 글
| [python] 파이썬 타입 힌트 (3) | 2024.10.29 |
|---|---|
| [python/HTML] unescape 언이스케이핑 하는법 (2) | 2024.10.29 |
| [HTTP/응답코드] 코드별 간단 상태 정리 (2) | 2024.10.27 |
| [python] 파이썬 클라우드에서 실행하는 무료 배치 스케줄러 python anywhere 사용법 (2) | 2024.10.22 |
| [python] datetime 모듈 - 오늘날짜/현재시간/날짜객체 생성 (2) | 2024.10.17 |