Skip to content

Commit fd667e7

Browse files
committed
adding Kanye quotes generator
1 parent 7f54c57 commit fd667e7

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

kanye-quotes/background.png

22.8 KB
Loading

kanye-quotes/kanye.png

22.7 KB
Loading

kanye-quotes/main.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from tkinter import *
2+
import requests
3+
4+
5+
def get_quote():
6+
response = requests.get(url='https://api.kanye.rest')
7+
if response.status_code == 200:
8+
quote = response.json()['quote']
9+
canvas.itemconfig(quote_text, text=quote)
10+
else:
11+
canvas.itemconfig(quote_text, text='Oops, something went wrong- Not by Kanye')
12+
13+
14+
window = Tk()
15+
window.title("Kanye Says...")
16+
window.config(padx=50, pady=50)
17+
18+
canvas = Canvas(width=300, height=414)
19+
background_img = PhotoImage(file="background.png")
20+
canvas.create_image(150, 207, image=background_img)
21+
quote_text = canvas.create_text(150, 207, text="Kanye Quote Goes HERE", width=250, font=("Arial", 30, "bold"),
22+
fill="white")
23+
canvas.grid(row=0, column=0)
24+
25+
kanye_img = PhotoImage(file="kanye.png")
26+
kanye_button = Button(image=kanye_img, highlightthickness=0, command=get_quote)
27+
kanye_button.grid(row=1, column=0)
28+
29+
window.mainloop()

0 commit comments

Comments
 (0)