Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as Tk
- class Cmdwd():
- lyrics = [
- 'After the war I went back to New York',
- 'A-After the war I went back to New York',
- 'I finished up my studies and I practiced law',
- 'I practiced law, Burr worked next door',
- 'Even though we started at the very same time',
- 'Alexander Hamilton began to climb',
- 'How to account for his rise to the top?',
- 'Man, the man is',
- 'Non-stop'
- ]
- ref = 0
- def __init__(self):
- self.root = Tk.Tk()
- self.root.wm_title('Non-stop')
- self.root.minsize(width=0, height=50)
- self.lyric = Tk.StringVar()
- self.lyric.set(self.lyrics[0])
- # self.message displays the lyrics
- self.message = Tk.Message(self.root,
- textvariable= self.lyric, fg= 'blue', width=400,
- )
- self.message.pack(fill='y', expand=True)
- # self.button displays the next button
- self.button = Tk.Button(self.root,
- text= 'Next', fg= 'red', width=10, height=3
- ,command = self.advance)
- self.button.pack()
- # self.text displays the song title
- self.text = Tk.Message(self.root,
- text='Hamilton, Non-stop', fg='green', width=400
- )
- self.text.pack()
- self.root.minsize(width=500, height=200)
- self.root.mainloop()
- # this function advances the lyrics
- def advance(self):
- self.ref += 1
- if self.ref >= len(self.lyrics):
- quit()
- self.lyric.set(self.lyrics[self.ref])
- Cmdwd()
Advertisement
Add Comment
Please, Sign In to add comment