Guest User

pg_root_notes.py

a guest
Nov 8th, 2015
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. from reaper_python import *
  2. import C3toolbox
  3. import os
  4. import sys
  5. sys.argv=["Main"]
  6. import Tkinter
  7.  
  8. def execute(a):
  9.  
  10. global level_var
  11. global instrument_var
  12. global st1
  13. global st2
  14. global st3
  15. global st4
  16. global st5
  17. global st6
  18.  
  19. C3toolbox.startup()
  20.  
  21. level = str(level_var.get())
  22. grid_array = { '1/16' : 'e', '1/32' : 's' }
  23. grid = grid_array[level]
  24. instrument = str(instrument_var.get())
  25. instrument = C3toolbox.array_instruments[instrument]
  26. str1 = st1.get()
  27. str2 = st2.get()
  28. str3 = st3.get()
  29. str4 = st4.get()
  30. str5 = st5.get()
  31. str6 = st6.get()
  32. C3toolbox.pg_root_notes(instrument, int(str1), int(str2), int(str3), int(str4), int(srt5), int(str6))
  33. form.destroy()
  34.  
  35. def launch():
  36.  
  37. global level_var
  38. global instrument_var
  39. global st1
  40. global st2
  41. global st3
  42. global st4
  43. global st5
  44. global st6
  45. form = Tkinter.Tk()
  46. form.wm_title('Root Note Generator')
  47.  
  48. helpLf = Tkinter.Frame(form)
  49. helpLf.grid(row=0, column=1, sticky='NS', padx=5, pady=2)
  50.  
  51. tuningLb1 = Tkinter.Label(helpLf, \
  52. text="Tuning, All 0 = E Standard, -2 0 0 0 0 0 = Drop D)")
  53. tuningLb1.grid(row=1, column=1, padx=5, pady=2, sticky='W')
  54.  
  55. st1 = Tkinter.Entry(helpLf)
  56. st1.insert(0, "0")
  57. st1.config(width=5)
  58. st1.grid(row=2, column=1, padx=5, pady=2, sticky'W')
  59.  
  60. st2 = Tkinter.Entry(helpLf)
  61. st2.insert(0, "0")
  62. st2.config(width=5)
  63. st2.grid(row=2, column=2, padx=5, pady=2, sticky'W')
  64.  
  65. st3 = Tkinter.Entry(helpLf)
  66. st3.insert(0, "0")
  67. st3.config(width=5)
  68. st3.grid(row=2, column=3, padx=5, pady=2, sticky'W')
  69.  
  70. st4 = Tkinter.Entry(helpLf)
  71. st4.insert(0, "0")
  72. st4.config(width=5)
  73. st4.grid(row=2, column=4, padx=5, pady=2, sticky'W')
  74.  
  75. st5 = Tkinter.Entry(helpLf)
  76. st5.insert(0, "0")
  77. st5.config(width=5)
  78. st5.grid(row=2, column=5, padx=5, pady=2, sticky'W')
  79.  
  80. st6 = Tkinter.Entry(helpLf)
  81. st6.insert(0, "0")
  82. st6.config(width=5)
  83. st6.grid(row=2, column=6, padx=5, pady=2, sticky'W')
  84.  
  85. inFileLbl = Tkinter.Label(helpLf, text="Select Track")
  86. inFileLbl.grid(row=0, column=1, sticky='E', padx=5, pady=2)
  87.  
  88. OPTIONS = ["Real Guitar", "Real Guitar 22", "Real Bass", "Real Bass 22"]
  89.  
  90. instrument_var = Tkinter.StringVar(helpLf)
  91. instrument_var.set(OPTIONS[0]) # default value
  92.  
  93. instrumentOpt = apply(Tkinter.OptionMenu, (helpLf, instrument_var) + tuple(OPTIONS))
  94. instrumentOpt.grid(row=3, column=1, columnspan=1, sticky="WE", pady=3)
  95.  
  96. allBtn = Tkinter.Button(helpLf, text="Generate Root Notes", command= lambda: execute(0))
  97. allBtn.grid(row=5, column=1, rowspan=1, sticky="WE", padx=5, pady=2)
  98.  
  99. logo = Tkinter.Frame(form, bg="#000")
  100. logo.grid(row=4, column=0, columnspan=3, sticky='WE', \
  101. padx=0, pady=0, ipadx=0, ipady=0)
  102.  
  103. path = os.path.join( sys.path[0], "banner.gif" )
  104. img = Tkinter.PhotoImage(file=path)
  105. imageLbl = Tkinter.Label(logo, image = img, borderwidth=0)
  106. imageLbl.grid(row=0, column=0, rowspan=2, sticky='E', padx=0, pady=0)
  107.  
  108. form.mainloop()
  109.  
  110. if __name__ == '__main__':
  111. launch()
Advertisement
Add Comment
Please, Sign In to add comment