|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- from tkinter import * # all the classic tkinter stuff
- from tkinter.ttk import Frame, Label, Button, LabelFrame, Combobox, Style, Checkbutton, Entry, Panedwindow
-
- # FUNKTIONEN DIE DURCH GUI KLICKS AUSGEFÜHRT WERDEN---------------------------------------------------------------------
-
- def button_rauschen_minus_press():
- print("Rauschen_Press_Plus pressed")
-
-
- def button_rauschen_plus_press():
- print("Rauschen Press_Minus pressed")
-
-
- # Ohr (links/beide/rechts)
- def button_linkes_ohr_press():
- print("button linkes ohr pressed")
-
-
- def button_beide_ohren_press():
- print("button beide ohren pressed")
-
-
- def button_rechtes_ohr_press():
- print("button rechtes ohr pressed")
-
-
- # Lautstärke
- def scale_lautstärke_change(self):
- lautstärke = float(scaleLautstärke.get())
- print(lautstärke)
-
- def button_ohren_synchro():
- auswahl = comboOhrenSynchro.get() # holt die momentane Auswahl aus combobox
- print("Einstellungen von:" + auswahl + " auf alle anderen Ohren setzen")
-
-
- # AUFBAU DES ROOT WINDOWS ----------------------------------------------------------------------------------------------
- root = Tk() # build the main window
- root.title("Tinnitus Analyse")
- #root.iconbitmap('headphones.ico') #todo: fix icon
- root.minsize(width=800, height=600)
- root.resizable(True, True)
- #root.columnconfigure(0, weight=1)
- root.rowconfigure(0, weight=1) # extra platz nach unten wird automatisch von Frames eingenommen
-
-
- # DIE DREI OBEREN FRAMES AUFBAUEN---------------------------------------------------------------------------------------
- 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
- linkerFrame.grid(column=0, row=0, sticky=(N + W + E + S)) # the frame sticks to every side of the window when resized
-
- mittlererFrame = LabelFrame(root, text="beide Ohren", width=100, height=100, padding="3 3 30 30")
- mittlererFrame.grid(column=1, row=0, sticky=(N + W + E + S))
-
- rechterFrame = LabelFrame(root, text="rechtes Ohr", width=100, height=100, padding="3 3 30 30")
- rechterFrame.grid(column=2, row=0, sticky=(N + W + E + S))
-
-
- # DIE DREI OBEREN FRAMES FÜLLEN-----------------------------------------------------------------------------------------
- labelFrames = [linkerFrame, mittlererFrame, rechterFrame]
- for aktLabelFrame in labelFrames:
- # -------- FREQUENZ ------------------------
- labelFrequenz = Label(aktLabelFrame, text="Frequenz [kHz]")
- labelFrequenz.grid(row=0, column=0, sticky=W) # sticky = w(est) makes the text left aligned
- frequenz = DoubleVar() # Frequenz Variable [kHz]
- entryFrequenz = Entry(aktLabelFrame, textvariable=frequenz) # create a field where u can enter text
- entryFrequenz.grid(column=1, row=0, sticky=W) # position the field
- # todo: Failproof the entry field to just numbers between a range!
- # todo: add function to entry change!
- # ----------- RAUSCHEN --------------------
- # todo: iwas überlegen ich brauch 3 verschiedene stringVars eigentlich für jedes Ohr!!!
- # todo: add function to entry change
- labelRauschen = Label(aktLabelFrame, text="Rauschen[+/- kHz]", anchor="w")
- labelRauschen.grid(column=0, row=1, sticky=W)
- buttonRauschenPlus = Button(aktLabelFrame, text="+", command=button_rauschen_plus_press)
- buttonRauschenPlus.grid(column=2, row=1)
- buttonRauschenMinus = Button(aktLabelFrame, text="-", command=button_rauschen_minus_press)
- buttonRauschenMinus.grid(column=3, row=1)
- rauschen = StringVar() # Rauschen Variable [+/- kHz]
- entryRauschen = Entry(aktLabelFrame, textvariable=rauschen) # create a field where u can enter text
- entryRauschen.grid(column=1, row=1, sticky=W) # position the field
- # ------------------ LAUTSTÄRKE ------------------
- labelLautstärke = Label(aktLabelFrame, text="Lautstärke [%]:")
- labelLautstärke.grid(column=0, row=3, sticky="w")
- scaleLautstärke = Scale(aktLabelFrame, from_=0, to=100, orient=HORIZONTAL, length=200, command=scale_lautstärke_change)
- scaleLautstärke.grid(column=1, row=3, columnspan=2)
- # ------------ KOMMENTAR ----------------
- labelKommentar = Label(aktLabelFrame, text="weitere Kommentare:")
- labelKommentar.grid(column=0, row=4)
- kommentar = StringVar() # Rauschen Variable [+/- kHz]
- entryKommentar = Entry(aktLabelFrame, textvariable=kommentar, width=33) # create a field where u can enter text
- entryKommentar.grid(column=1, row=4, rowspan=4, columnspan=2, sticky=W)
-
-
- # DEN UNTEREN FRAME BAUEN-----------------------------------------------------------------------------------------------
- untererFrame = LabelFrame(root, text="Generelles", width=300, height=100, padding="3 3 30 30")
- untererFrame.grid(column=0, row=1, columnspan=3, sticky=(N + W + E + S))
-
- # DEN UNTEREN FRAME FÜLLEN----------------------------------------------------------------------------------------------
- # ------------NAMENSEINGABE-------------
- labelNachname = Label(untererFrame, text="Nachname:")
- labelNachname.grid(column=0, row=0)
- nachname = StringVar()
- entryNachname = Entry(untererFrame, textvariable=nachname)
- entryNachname.grid(column=1, row=0)
- labelVorname = Label(untererFrame, text="Vorname:")
- labelVorname.grid(column=2, row=0)
- vorname = StringVar()
- entryVorname = Entry(untererFrame, textvariable=vorname)
- entryVorname.grid(column=3, row=0)
- # ------------------OHRENAUSWAHL-----------
- labelOhren = Label(untererFrame, text="Audioausgabe auf:")
- labelOhren.grid(column=0, row=1, sticky="w")
- buttonLinkesOhr = Button(untererFrame, text="linkem Ohr", command=button_linkes_ohr_press)
- buttonLinkesOhr.grid(column=1, row=1)
- buttonBeideOhren = Button(untererFrame, text="beiden Ohren", command=button_beide_ohren_press)
- buttonBeideOhren.grid(column=2, row=1)
- buttonRechtesOhr = Button(untererFrame, text="rechtem Ohr", command=button_rechtes_ohr_press)
- buttonRechtesOhr.grid(column=3, row=1)
- # --------- OHREN SYNCHRONISIEREN -----------------------
- labelOhrenSynchro = Label(untererFrame, text="Einstellungen von ")
- labelOhrenSynchro.grid(column=0, row=2)
- comboOhrenSynchro = Combobox(untererFrame, values=["Linkes Ohr", "Rechtes Ohr", "Beide Ohren"])
- comboOhrenSynchro.grid(column=1, row=2)
- labelOhrenSynchro2 = Label(untererFrame, text=" für alle anderen Ohren übernehmen")
- labelOhrenSynchro2.grid(column=2, row=2)
- buttonOhrenSynchro = Button(untererFrame, text="Bestätigen", command=button_ohren_synchro)
- buttonOhrenSynchro.grid(column=3, row=2)
-
- # ----------- SPEICHERN --------------------
- buttonSpeichern = Button(untererFrame, text="SPEICHERN")
- buttonSpeichern.grid(column=6, row=3)
-
-
-
-
- root.mainloop()
|