You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

app.py 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Fri Sep 4 11:36:24 2020
  4. @author:
  5. V0.1 Matthias Eidel
  6. V0.2 Igor Beloschapkin
  7. V0.3 Igor Beloschapkin
  8. """
  9. from tkinter import *
  10. import tkinter.font as tkFont
  11. #import tkMessageBox
  12. import os
  13. # own code:
  14. # from questionnaire import quest
  15. ##################################################
  16. # Config Beginn
  17. # Folgende Strings bitte an jeweiligen PC anpassen
  18. # in folgendem Format: variable = r'C:\Pfad' ("r" vor Pfad nicht vergessen!!!)
  19. # Hier findet man die Ordner batch, data, icons, parms, prog, tools
  20. pathBci2000 = r'C:\BCI2000\BCI2000 v3.6.beta.R5570\BCI2000.x64'
  21. # Hier findet man den TactileBCIFilter.exe
  22. pathTactileBciFilter = r'C:\Users\bci\Desktop\Qt Filter Program\build-TactileBCIFilter-Desktop_Qt_5_15_0_MinGW_32_bit-Release\release'
  23. # Hier findet man die P300Classifier.exe
  24. pathP300Classifier = r'C:\Users\bci\Desktop\Igor\PythonBCIgui_v0.2\bin'
  25. # TODO Config in txt file verlagern
  26. # Config Ende
  27. ##################################################
  28. class App:
  29. def __init__(self, master):
  30. # self.paradigmText = sys.argv[1]
  31. # App.paradigmText = sys.argv[1]
  32. # print sys.argv[1]
  33. # pathOrigin = os.path.dirname(os.path.realpath(__file__))
  34. # global pathSave
  35. # pathSave = "\\questions\\" + self.paradigmText
  36. # pathSave = os.getcwd() + pathSave
  37. textH = 2
  38. textHsmall = 2
  39. textW = 8
  40. def makeBtn(self, text, bg, command, side):
  41. self.button = Button(frame, text=text, bg=bg, command=command)
  42. self.button.config( height = textH, width = textW )
  43. self.button['font'] = tkFont.Font(family='Helvetica', size=36, weight='bold')
  44. self.button.pack(side=side)
  45. return self.button
  46. def makeBtnSmall(self, text, bg, command, side):
  47. self.button = Button(frame, text=text, bg=bg, command=command)
  48. self.button.config( height = textHsmall, width = textW )
  49. self.button['font'] = tkFont.Font(family='Helvetica', size=16, weight='bold')
  50. self.button.pack(side=side)
  51. return self.button
  52. frame = Frame(master)
  53. frame.pack()
  54. # button generation
  55. self.Bfilter = makeBtn(self, "1. Filter", "lightblue", self.btn_filter, LEFT)
  56. self.BtacCal = makeBtn(self, "2. Calibrate", "lightblue", self.btn_tacCal, LEFT)
  57. self.Bp300 = makeBtn(self, "3. P300 Classifier", "lightblue", self.btn_p300, LEFT)
  58. self.BtacCopy = makeBtn(self, "Tactile Copy", "lightblue", self.btn_tacCopy, LEFT)
  59. self.BtacQuest = makeBtnSmall(self, "Fragebogen", "lightgreen", self.btn_tacQuest, LEFT)
  60. frame.rowconfigure((0,1), weight=1) # make buttons stretch when
  61. frame.columnconfigure((0,2), weight=1) # when window is resized
  62. # self.Bfilter.grid(row=0, column=0, columnspan=1, sticky='EWNS')
  63. # self.BtacCal.grid(row=1, column=0, columnspan=1, sticky='EWNS')
  64. # self.Bp300.grid(row=2, column=0, columnspan=1, sticky='EWNS')
  65. # self.BtacCopy.grid(row=3, column=0, columnspan=1, sticky='EWNS')
  66. # self.BtacQuest.grid(row=4, column=0, columnspan=1, sticky='EWNS')
  67. # 1. FILTER ##################################
  68. def btn_filter(self):
  69. print('Starte TactileBCIFilter.exe')
  70. os.startfile(pathTactileBciFilter + '\TactileBCIFilter.exe')
  71. # 2. KALIBIERUNGEN ###########################
  72. def btn_tacCal(self):
  73. print('starte taktile kalibrierung')
  74. os.system('bin\WT-tacCalib.bat')
  75. # 3. P300 Classifier #########################
  76. def btn_p300(self):
  77. print('Starte P300 Classifier')
  78. os.startfile(pathP300Classifier + '\P300Classifier.exe')
  79. # 3. COPYSPELL ###########################
  80. def btn_tacCopy(self):
  81. print('starte tactile bci')
  82. os.system('bin\WT-tacCopy.bat')
  83. # QUESTIONNAIRE PROMPT ###########################
  84. # def btn_visQuest(self):
  85. # #os.system('python .\PythonBCIgui\q-helper.py ' + "Visual")
  86. # root.destroy()
  87. # self.startQuestions("Visual")
  88. def btn_tacQuest(self):
  89. root.destroy()
  90. self.startQuestions("Tactile")
  91. # def btn_audQuest(self):
  92. # root.destroy()
  93. # self.startQuestions("Auditory")
  94. def startQuestions(self, para):
  95. print('starte Fragebogen')
  96. # TODO
  97. # q = quest(para)
  98. # q.qSatisfaction()
  99. # q.qExhaustion()
  100. # q.qSubjControl()
  101. # q.qCtrlChange()
  102. # q.save()
  103. def global_close(self, window):
  104. print('quitting?')
  105. window.destroy()
  106. root = Tk()
  107. def on_closing():
  108. #self.global_close(root)
  109. print('quitting?')
  110. root.destroy()
  111. root.protocol("WM_DELETE_WINDOW", on_closing)
  112. app = App(root)
  113. root.mainloop()
  114. #root.destroy() # optional;