Datenablage für Tinnitus Therapie Projektarbeit von Julian Seyffer und Heiko Ommert SS2020
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.

TinnitusAnalyse_GUI.py 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. from tkinter import * # all the classic tkinter stuff
  2. from tkinter.ttk import Frame, Label, Button, LabelFrame, Combobox, Style, Checkbutton, Entry, Panedwindow
  3. # FUNKTIONEN DIE DURCH GUI KLICKS AUSGEFÜHRT WERDEN---------------------------------------------------------------------
  4. def button_rauschen_minus_press():
  5. print("Rauschen_Press_Plus pressed")
  6. def button_rauschen_plus_press():
  7. print("Rauschen Press_Minus pressed")
  8. # Ohr (links/beide/rechts)
  9. def button_linkes_ohr_press():
  10. print("button linkes ohr pressed")
  11. def button_beide_ohren_press():
  12. print("button beide ohren pressed")
  13. def button_rechtes_ohr_press():
  14. print("button rechtes ohr pressed")
  15. # Lautstärke
  16. def scale_lautstärke_change(self):
  17. lautstärke = float(scaleLautstärke.get())
  18. print(lautstärke)
  19. def button_ohren_synchro():
  20. auswahl = comboOhrenSynchro.get() # holt die momentane Auswahl aus combobox
  21. print("Einstellungen von:" + auswahl + " auf alle anderen Ohren setzen")
  22. # AUFBAU DES ROOT WINDOWS ----------------------------------------------------------------------------------------------
  23. root = Tk() # build the main window
  24. root.title("Tinnitus Analyse")
  25. #root.iconbitmap('headphones.ico') #todo: fix icon
  26. root.minsize(width=800, height=600)
  27. root.resizable(True, True)
  28. #root.columnconfigure(0, weight=1)
  29. root.rowconfigure(0, weight=1) # extra platz nach unten wird automatisch von Frames eingenommen
  30. # DIE DREI OBEREN FRAMES AUFBAUEN---------------------------------------------------------------------------------------
  31. linkerFrame = LabelFrame(root, text="linkes Ohr", width=100, height = 100, padding="3 3 30 30") # parent is root, padding is extra space at the edges
  32. linkerFrame.grid(column=0, row=0, sticky=(N + W + E + S)) # the frame sticks to every side of the window when resized
  33. mittlererFrame = LabelFrame(root, text="beide Ohren", width=100, height=100, padding="3 3 30 30")
  34. mittlererFrame.grid(column=1, row=0, sticky=(N + W + E + S))
  35. rechterFrame = LabelFrame(root, text="rechtes Ohr", width=100, height=100, padding="3 3 30 30")
  36. rechterFrame.grid(column=2, row=0, sticky=(N + W + E + S))
  37. # DIE DREI OBEREN FRAMES FÜLLEN-----------------------------------------------------------------------------------------
  38. labelFrames = [linkerFrame, mittlererFrame, rechterFrame]
  39. for aktLabelFrame in labelFrames:
  40. # -------- FREQUENZ ------------------------
  41. labelFrequenz = Label(aktLabelFrame, text="Frequenz [kHz]")
  42. labelFrequenz.grid(row=0, column=0, sticky=W) # sticky = w(est) makes the text left aligned
  43. frequenz = DoubleVar() # Frequenz Variable [kHz]
  44. entryFrequenz = Entry(aktLabelFrame, textvariable=frequenz) # create a field where u can enter text
  45. entryFrequenz.grid(column=1, row=0, sticky=W) # position the field
  46. # todo: Failproof the entry field to just numbers between a range!
  47. # todo: add function to entry change!
  48. # ----------- RAUSCHEN --------------------
  49. # todo: iwas überlegen ich brauch 3 verschiedene stringVars eigentlich für jedes Ohr!!!
  50. # todo: add function to entry change
  51. labelRauschen = Label(aktLabelFrame, text="Rauschen[+/- kHz]", anchor="w")
  52. labelRauschen.grid(column=0, row=1, sticky=W)
  53. buttonRauschenPlus = Button(aktLabelFrame, text="+", command=button_rauschen_plus_press)
  54. buttonRauschenPlus.grid(column=2, row=1)
  55. buttonRauschenMinus = Button(aktLabelFrame, text="-", command=button_rauschen_minus_press)
  56. buttonRauschenMinus.grid(column=3, row=1)
  57. rauschen = StringVar() # Rauschen Variable [+/- kHz]
  58. entryRauschen = Entry(aktLabelFrame, textvariable=rauschen) # create a field where u can enter text
  59. entryRauschen.grid(column=1, row=1, sticky=W) # position the field
  60. # ------------------ LAUTSTÄRKE ------------------
  61. labelLautstärke = Label(aktLabelFrame, text="Lautstärke [%]:")
  62. labelLautstärke.grid(column=0, row=3, sticky="w")
  63. scaleLautstärke = Scale(aktLabelFrame, from_=0, to=100, orient=HORIZONTAL, length=200, command=scale_lautstärke_change)
  64. scaleLautstärke.grid(column=1, row=3, columnspan=2)
  65. # ------------ KOMMENTAR ----------------
  66. labelKommentar = Label(aktLabelFrame, text="weitere Kommentare:")
  67. labelKommentar.grid(column=0, row=4)
  68. kommentar = StringVar() # Rauschen Variable [+/- kHz]
  69. entryKommentar = Entry(aktLabelFrame, textvariable=kommentar, width=33) # create a field where u can enter text
  70. entryKommentar.grid(column=1, row=4, rowspan=4, columnspan=2, sticky=W)
  71. # DEN UNTEREN FRAME BAUEN-----------------------------------------------------------------------------------------------
  72. untererFrame = LabelFrame(root, text="Generelles", width=300, height=100, padding="3 3 30 30")
  73. untererFrame.grid(column=0, row=1, columnspan=3, sticky=(N + W + E + S))
  74. # DEN UNTEREN FRAME FÜLLEN----------------------------------------------------------------------------------------------
  75. # ------------NAMENSEINGABE-------------
  76. labelNachname = Label(untererFrame, text="Nachname:")
  77. labelNachname.grid(column=0, row=0)
  78. nachname = StringVar()
  79. entryNachname = Entry(untererFrame, textvariable=nachname)
  80. entryNachname.grid(column=1, row=0)
  81. labelVorname = Label(untererFrame, text="Vorname:")
  82. labelVorname.grid(column=2, row=0)
  83. vorname = StringVar()
  84. entryVorname = Entry(untererFrame, textvariable=vorname)
  85. entryVorname.grid(column=3, row=0)
  86. # ------------------OHRENAUSWAHL-----------
  87. labelOhren = Label(untererFrame, text="Audioausgabe auf:")
  88. labelOhren.grid(column=0, row=1, sticky="w")
  89. buttonLinkesOhr = Button(untererFrame, text="linkem Ohr", command=button_linkes_ohr_press)
  90. buttonLinkesOhr.grid(column=1, row=1)
  91. buttonBeideOhren = Button(untererFrame, text="beiden Ohren", command=button_beide_ohren_press)
  92. buttonBeideOhren.grid(column=2, row=1)
  93. buttonRechtesOhr = Button(untererFrame, text="rechtem Ohr", command=button_rechtes_ohr_press)
  94. buttonRechtesOhr.grid(column=3, row=1)
  95. # --------- OHREN SYNCHRONISIEREN -----------------------
  96. labelOhrenSynchro = Label(untererFrame, text="Einstellungen von ")
  97. labelOhrenSynchro.grid(column=0, row=2)
  98. comboOhrenSynchro = Combobox(untererFrame, values=["Linkes Ohr", "Rechtes Ohr", "Beide Ohren"])
  99. comboOhrenSynchro.grid(column=1, row=2)
  100. labelOhrenSynchro2 = Label(untererFrame, text=" für alle anderen Ohren übernehmen")
  101. labelOhrenSynchro2.grid(column=2, row=2)
  102. buttonOhrenSynchro = Button(untererFrame, text="Bestätigen", command=button_ohren_synchro)
  103. buttonOhrenSynchro.grid(column=3, row=2)
  104. # ----------- SPEICHERN --------------------
  105. buttonSpeichern = Button(untererFrame, text="SPEICHERN")
  106. buttonSpeichern.grid(column=6, row=3)
  107. root.mainloop()