Globale Variablen für P und I Anteile eingeführt, Beisiel Koordinaten stehen nun bereits in der Textbox und auch ein Graph wird bereits erstellt, die Funktion 'on_plot_button_click()' wurde eingeführt, nun werden die eingestellten P und I Werte in die globalen Variablen abgespeichert, dies geschicht immer dann, wenn der Button 'plot_button' geklickt wird.
This commit is contained in:
18
main.py
18
main.py
@@ -4,6 +4,9 @@ import matplotlib.pyplot as plt
|
|||||||
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
|
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
|
||||||
from matplotlib.figure import Figure
|
from matplotlib.figure import Figure
|
||||||
|
|
||||||
|
p = 0.0
|
||||||
|
i = 0.0
|
||||||
|
|
||||||
class T2000ErdemGUI:
|
class T2000ErdemGUI:
|
||||||
def __init__(self, root):
|
def __init__(self, root):
|
||||||
self.root = root
|
self.root = root
|
||||||
@@ -23,6 +26,7 @@ class T2000ErdemGUI:
|
|||||||
tk.Label(self.root, text="Koordinaten der Drehmoment-Drehwinkel-Kennlinie:").place(x=10, y=90)
|
tk.Label(self.root, text="Koordinaten der Drehmoment-Drehwinkel-Kennlinie:").place(x=10, y=90)
|
||||||
self.coordinates_text = tk.Text(self.root, height=5, width=20)
|
self.coordinates_text = tk.Text(self.root, height=5, width=20)
|
||||||
self.coordinates_text.place(x=20, y=110)
|
self.coordinates_text.place(x=20, y=110)
|
||||||
|
self.coordinates_text.insert('end', '0,0\n5,15\n10,10\n90,10')
|
||||||
|
|
||||||
# Eingabefeld für direkte Drehmomentvorgabe
|
# Eingabefeld für direkte Drehmomentvorgabe
|
||||||
tk.Label(self.root, text="Soll-Drehmoment in Nm:").place(x=10, y=220)
|
tk.Label(self.root, text="Soll-Drehmoment in Nm:").place(x=10, y=220)
|
||||||
@@ -43,7 +47,7 @@ class T2000ErdemGUI:
|
|||||||
self.close_button.place(x=350, y=560)
|
self.close_button.place(x=350, y=560)
|
||||||
|
|
||||||
# Button zur Erstellung des Diagramms
|
# Button zur Erstellung des Diagramms
|
||||||
self.plot_button = tk.Button(self.root, text="Eingaben übernehmen", command=self.create_diagram)
|
self.plot_button = tk.Button(self.root, text="Eingaben übernehmen", command=self.on_plot_button_click)
|
||||||
self.plot_button.place(x=10, y=560)
|
self.plot_button.place(x=10, y=560)
|
||||||
|
|
||||||
# Diagramm
|
# Diagramm
|
||||||
@@ -56,6 +60,8 @@ class T2000ErdemGUI:
|
|||||||
self.canvas = FigureCanvasTkAgg(self.figure, self.root)
|
self.canvas = FigureCanvasTkAgg(self.figure, self.root)
|
||||||
self.canvas.get_tk_widget().place(x=424, y=0)
|
self.canvas.get_tk_widget().place(x=424, y=0)
|
||||||
|
|
||||||
|
self.create_diagram()
|
||||||
|
|
||||||
def close_application(self):
|
def close_application(self):
|
||||||
if messagebox.askokcancel("Beenden", "Möchten Sie die Anwendung wirklich beenden?"):
|
if messagebox.askokcancel("Beenden", "Möchten Sie die Anwendung wirklich beenden?"):
|
||||||
self.root.quit()
|
self.root.quit()
|
||||||
@@ -81,7 +87,15 @@ class T2000ErdemGUI:
|
|||||||
self.current_angle.config(text=str(angle))
|
self.current_angle.config(text=str(angle))
|
||||||
self.current_torque.config(text=str(torque))
|
self.current_torque.config(text=str(torque))
|
||||||
|
|
||||||
|
def save_set_values(self):
|
||||||
|
p = self.p_value.get()
|
||||||
|
i = self.i_value.get()
|
||||||
|
|
||||||
|
def on_plot_button_click(self):
|
||||||
|
self.create_diagram()
|
||||||
|
self.save_set_values()
|
||||||
|
|
||||||
# Anwendung starten
|
# Anwendung starten
|
||||||
root = tk.Tk()
|
root = tk.Tk()
|
||||||
app = T2000ErdemGUI(root)
|
app = T2000ErdemGUI(root)
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
Reference in New Issue
Block a user