-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvizify.py
More file actions
68 lines (50 loc) · 2.28 KB
/
vizify.py
File metadata and controls
68 lines (50 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from tkinter import *
from spotify_data import *
from visualizer import *
from shape_classes import *
#function that button calls
def execute():
"""
Executes the visualizer when the button is pressed
"""
songtitle = songentry.get()
artistname = artistentry.get()
if not songtitle:
run_visualizer()
else:
run_visualizer(songtitle, artistname)
color = 'SlateGray2' #sets the background color for everything to use
#create tkinter master window
window = Tk()
frame = Frame(window, bg = color)
frame.pack(expand = 'true')
window.title("Vizify")
#Define frame for use by Vizify title text
titleframe = Frame(window, bg = color)
titleframe.pack(expand = 'true',side = TOP, fill = 'both')
title = Label(titleframe,bg = color, text = "VIZIFY", font = ('DINOT', 128, 'bold'))
title.pack(expand = 'true', fill = 'both', side = TOP)
# Define frame for use by instructions and description text
infoframe = Frame(window, bg = color)
infoframe.pack(expand = 'true', fill = 'both', side = TOP)
searchlabel = Label(infoframe, bg = color, text = "Enter the song you want to Visualize below,\n or leave them blank to visualize the currently playing song.",
font = ('DINOT', 18, 'bold')) #Creates a label entity with instructions
searchlabel.pack(expand = 'true', fill = 'both', side = TOP)
songentry = Entry(infoframe) #creates a text entry widget that stores the name of the song
songentry.pack( expand = 'true', side = LEFT)
bylabel = Label(infoframe, bg = color, text = "by", font = ('DINOT', 18, 'bold'))
bylabel.pack(padx = 0, side = LEFT)
artistentry = Entry(infoframe) #creates a text entry widget for artist name
artistentry.pack( expand = 'true', side = LEFT)
#Define frame for use by button
play_frame = Frame(window, bg = color)
play_frame.pack(expand = 'true', fill = 'both', side = TOP)
playbtn = Button(play_frame, text = "play", command = execute)
playbtn.pack(expand = 'true', side = TOP)
exitinstructions = Label(play_frame, bg = color, text = "press the escape key to quit at any time")
exitinstructions.pack(expand = 'true', fill = 'both', side = TOP)
# make the top right close button minimize (iconify) the main window
window.protocol("WM_DELETE_WINDOW", window.iconify)
# make Esc exit the program
window.bind('<Escape>', lambda e: window.destroy())
window.mainloop()