SHARE
TWEET

PythonGuitarNotes

a guest May 19th, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from tkinter import Text, Label, Tk, Button
  2. import threading, time, random
  3. words = ['A', 'B', 'C', 'D', 'E', 'F', "G"]
  4. def click(event, text):
  5.     global pause
  6.     if text == 'Start':
  7.         pause = False
  8.         button['text'] = 'Stop'
  9.         mainthread = threading.Thread(target=main)
  10.         mainthread.start()
  11.     else:
  12.         pause = True
  13.         button['text'] = 'Start'
  14. def gui():
  15.     global label, button
  16.     root = Tk()
  17.     root.geometry('500x300')
  18.     root.title("GuitarGuiNotes")
  19.     label = Label(root)
  20.     label.config(font=("Courier", 200))
  21.     label.place(x=300,y=1)
  22.  
  23.     button = Button(text='Start', height=4, width=6)
  24.     button.config(font=("Courier", 50))
  25.     button.place(x=1,y=1)
  26.     button.bind("<Button-1>", lambda event: click(event, button["text"]))
  27.     root.mainloop()
  28. def main():
  29.     time.sleep(1)
  30.     while True:
  31.         try:
  32.             if pause == True:
  33.                 break
  34.             else:
  35.                 True
  36.         except:
  37.             break
  38.         last = words[random.randint(0, 6)]
  39.         try:
  40.             if oklast == last:
  41.                 continue
  42.             else:
  43.                 None
  44.         except:
  45.             None
  46.         oklast = last
  47.         label['text'] = last
  48.         time.sleep(2)
  49. guithread = threading.Thread(target=gui)
  50. guithread.start()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top