<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Forum Bauen und Umwelt - Genauere Zeitnahme in Windows</title>
<link>https://bauforum.wirklichewelt.de/</link>
<description>Das Bauforum</description>
<language>de</language>
<item>
<title>Genauere Zeitnahme in Windows (Antwort)</title>
<content:encoded><![CDATA[<p>Leider gibt es wohl viele Windows-Rechner, bei denen die Python-Funktion time.time() nur recht ungenaue Werte liefert, da sie nicht im Milli- oder Mikrosekundentakt wie unter Linux aktualisiert wird, sondern nur ungefähr 60 Mal pro Sekunde. Da sich damit schwerlich die zwischen zwei Rechenschritten verstrichene Zeit messen lässt, verwendet das Programm nun für Zeitmessungen die mit Python 3.3 neu eingeführte, ungleich präzisere Funktion time.perf_counter(), die selbst unter Windows brauchbar ist.</p>
<p><br />
<img src="https://bauforum.wirklichewelt.de/images/uploaded/Bild_OX9OI0LA1.png" alt="[image]"  /><br />
 <br />
<strong>Download:<br />
<a href="images/uploaded/ZIP-Archiv_XQGMILX91.zip" target="_blank"><img src="img/zip.png" alt="[image]"  />ZIP-Archiv_XQGMILX91.zip</a></strong></p>
<pre class="python" style="font-family:monospace;"><ol><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Interaktive Physiksimulation mit Massen und Federn</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># 2016-12-22 Martin Vogel, Hochschule Bochum</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># cc-by-sa-3.0 https://creativecommons.org/licenses/by-sa/3.0/de/</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Fragen und Diskussion:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># http://bauforum.wirklichewelt.de/index.php?nr=11343</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">from</span> tkinter <span style="color: #ff7700;">import</span> *</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">from</span> <span style="color: #dc143c;">math</span> <span style="color: #ff7700;">import</span> hypot<span style="color: #000;">,</span>atan2<span style="color: #000;">,</span>sin<span style="color: #000;">,</span>cos</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">from</span> <span style="color: #dc143c;">random</span> <span style="color: #ff7700;">import</span> randint</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">from</span> <span style="color: #dc143c;">time</span> <span style="color: #ff7700;">import</span> perf_counter<span style="color: #000;">,</span> sleep</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">from</span> <span style="color: #dc143c;">threading</span> <span style="color: #ff7700;">import</span> Thread<span style="color: #000;">,</span> Lock</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Das Hauptfenster des Programms wird erzeugt und der TCL-Interpreter</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># geladen. Alle weiteren davon abhängigen Fenster werden mittels Toplevel()</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># erzeugt.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">T <span style="color: #000;">=</span> Tk<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">T.<span style="color: black;">title</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;Massen und Federn (Hilfe mit F1)&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Die Zeichenfläche Canvas soll sich Größenänderungen des Hauptfensters</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># anpassen können.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">C <span style="color: #000;">=</span> Canvas<span style="color: black;">&#40;</span>T<span style="color: #000;">,</span>width<span style="color: #000;">=</span><span style="color: #008;">800</span><span style="color: #000;">,</span>height<span style="color: #000;">=</span><span style="color: #008;">600</span><span style="color: #000;">,</span>bg<span style="color: #000;">=</span><span style="color: #080;">&quot;white&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">C.<span style="color: black;">pack</span><span style="color: black;">&#40;</span>expand<span style="color: #000;">=</span><span style="color: #080;">&quot;yes&quot;</span><span style="color: #000;">,</span>fill<span style="color: #000;">=</span><span style="color: #080;">&quot;both&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Kurze Erläuterung der Programmfunktionen:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> Hilfe<span style="color: black;">&#40;</span>event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    messagebox.<span style="color: black;">showinfo</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;Hilfe&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                        <span style="color: #080;">&quot;Massen und Federn&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                        detail<span style="color: #000;">=</span><span style="color: #080;">&quot;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">Dieses physikalische Modell besteht aus blauen Lagerpunkten, roten </span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">Massepunkten und grauen Stabfedern. Die Lagerpunkte und die Massepunkte </span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">können mit der Maus verschoben werden. Die Federn folgen dieser Bewegung.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">nn</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">Neue Massepunkte und Lagerpunkte lassen sich mit den Tasten „M“ und „L“ sowie </span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">mit der rechten Maustaste erzeugen. Massepunkte werden mittels einer Feder </span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">mit dem nächstliegenden verschieblichen Punkt verbunden, wenn die Gravitation </span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">ungleich null ist. Zum schnellen Einschalten der Schwerelosigkeit dient der </span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">Button „Antigravity“.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">nn</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">Neue Federn werden durch zweimaliges Drücken der rechten Maustaste oder der </span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">Taste „F“ jeweils am Start- und am Zielobjekt angebunden. Unerwünschte Druck- </span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">oder Zugspannungen in den Federn, die während des Konstruierens entstehen </span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">können, lassen sich mit dem Button „Entspannen“ auf null setzen.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">nn</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">Bei hohen Federsteifigkeiten und geringen Kugelmassen neigt das Modell dazu, </span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">in dramatischer Weise aufzuschwingen. Der Dämpfungsregler sollte daher niemals </span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">auf einem zu kleinen Wert stehen.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">nn</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">Das Löschen von Objekten ist noch nicht implementiert. Auch das Laden und </span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">Speichern von Modellen und Reglerstellungen wird der geneigten Leserin und </span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">dem geneigten Leser des Python-3-Quelltextes dieses Programms überlassen. </span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">nn</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">Viel Spaß damit!</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">nn</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">Martin Vogel, Hochschule Bochum, im Dezember 2016&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">class</span> C_Einstellungen:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;&quot;&quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">    Einige allgemeine Einstellungen, die zu experimentellen</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">    Zwecken variiert werden können.&quot;&quot;&quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Gravitation <span style="color: #000;">=</span> <span style="color: #008;">9.81</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Die Einheit der Gravitationsbeschleunigung ist hier Hektopixel</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># pro Quadratsekunde.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Federsteifigkeit <span style="color: #000;">=</span> <span style="color: #008;">100</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># 100 Krafteinheiten werden benötigt, um die Länge einer Feder</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># um das Maß ihrer Länge im entspannten Zustand zu verändern.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Masse <span style="color: #000;">=</span> <span style="color: #008;">5</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Die Masse der roten „Kugeln“.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Dämpfung <span style="color: #000;">=</span> <span style="color: #008;">5</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Bei einer zu geringen Dämpfung wird die Simulation instabil.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Bei hohen Federsteifigkeiten und geringen Massen muss unbedingt</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># eine stärkere Dämpfung eingestellt werden.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># todo: Die ganze Krampferei mit der Dämpfung gegen Aufschaukeln</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># könnte man sich sparen, wenn regelmäßig die aktuelle Gesamtenergie</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># des Systems ermittelt würde und bei Abdriften alle Geschwindigkeiten</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># um einen Korrekturfaktor reduziert würden.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Zeige_Federkräfte <span style="color: #000;">=</span> <span style="color: #808;">False</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Numerische Anzeige der Stabkräfte</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Zeige_Auflagerkräfte <span style="color: #000;">=</span> <span style="color: #808;">False</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Anzeige der Auflagerkräfte</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Zeige_Spur <span style="color: #000;">=</span> <span style="color: #808;">False</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Aufzeichnung der Massepunktbewegung</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    PPS <span style="color: #000;">=</span> <span style="color: #008;">240</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Physikschritte pro Sekunde. Dieser Wert passt sich</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># dynamisch an die Möglichkeiten der CPU an. Leider unterstützt</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># tkinter nur einen Thread, sodass es nicht möglich ist, die</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Grafikausgabe zu parallelisieren. Für die Berechnungen selbst</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># wird jedoch Multithreading eingesetzt.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Eine Instanz dieser Klasse speichert unsere ganzen Programmeinstellungen</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Einstellungen <span style="color: #000;">=</span> C_Einstellungen<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>                        </div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">class</span> Feder:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Feder von Objekt1 nach Objekt2</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span>Objekt1<span style="color: #000;">,</span>Objekt2<span style="color: #000;">,</span>k<span style="color: #000;">=</span>Einstellungen.<span style="color: black;">Federsteifigkeit</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Start- und Zielpunkt</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">x1</span><span style="color: #000;">,</span> <span style="color: #808;">self</span>.<span style="color: black;">y1</span> <span style="color: #000;">=</span> Objekt1.<span style="color: black;">x</span><span style="color: #000;">,</span> Objekt1.<span style="color: black;">y</span>       </div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">x2</span><span style="color: #000;">,</span> <span style="color: #808;">self</span>.<span style="color: black;">y2</span> <span style="color: #000;">=</span> Objekt2.<span style="color: black;">x</span><span style="color: #000;">,</span> Objekt2.<span style="color: black;">y</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Federkonstante k (könnte auch Federsteifigkeit D heißen)</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">k</span> <span style="color: #000;">=</span> k </div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># aktuelle Länge</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">l</span> <span style="color: #000;">=</span> hypot<span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x2</span>-<span style="color: #808;">self</span>.<span style="color: black;">x1</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y2</span>-<span style="color: #808;">self</span>.<span style="color: black;">y1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Anzeige der Federkraft (None oder Canvas-ID des Textes)</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Kraftanzeige</span> <span style="color: #000;">=</span> <span style="color: #808;">None</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Weil an diese Feder zwei Kugeln angeschlossen sein können,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># die wegen des Multithreadings praktisch gleichzeitig auf die</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Methoden der Feder zugreifen können, brauchen wir ein Stoppschild,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># welches die Anfrage der zweiten Kugel bei Bedarf etwas zurückhält:</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Lock</span> <span style="color: #000;">=</span> Lock<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Die Federn sollen nicht alle denselben Grauton haben.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Grauton <span style="color: #000;">=</span> randint<span style="color: black;">&#40;</span><span style="color: #008;">100</span><span style="color: #000;">,</span><span style="color: #008;">200</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Farbcode <span style="color: #000;">=</span> <span style="color: #080;">&quot;#&quot;</span>+<span style="color: #008;">3</span>*<span style="color: black;">&#40;</span><span style="color: #080;">&quot;%0X&quot;</span>%Grauton<span style="color: black;">&#41;</span> <span style="color: #800; font-style: italic;"># z.B. &quot;#C8C8C8&quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Canvas-Grafikobjekt der Feder; Form und Lage später durch update()</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">ID</span> <span style="color: #000;">=</span> C.<span style="color: black;">create_line</span><span style="color: black;">&#40;</span><span style="color: #008;">0</span><span style="color: #000;">,</span><span style="color: #008;">0</span><span style="color: #000;">,</span><span style="color: #008;">0</span><span style="color: #000;">,</span><span style="color: #008;">0</span><span style="color: #000;">,</span> width<span style="color: #000;">=</span><span style="color: #008;">3</span><span style="color: #000;">,</span> fill<span style="color: #000;">=</span>Farbcode<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Die Federn werden hinter allen verschieblichen Objekten (Auflager und</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Kugeln) angeordnet.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        C.<span style="color: black;">tag_lower</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">ID</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Breite und Windungszahl festlegen:</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">reset</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Federkraft berechnen (bzw. feststellen, dass diese null ist)</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># und Feder zum ersten Mal zeichnen:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">update</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Federn in die Federnliste der Start- und Zielobjekte aufnehmen</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Objekt1.<span style="color: black;">verbinde</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Objekt2.<span style="color: black;">verbinde</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span><span style="color: #008;">2</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> reset<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #080;">&quot;&quot;&quot;Entspannte Länge und Aussehen der Feder festlegen&quot;&quot;&quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Entspannte Länge auf aktuelle Länge setzen</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">l0</span> <span style="color: #000;">=</span> <span style="color: #808;">self</span>.<span style="color: black;">l</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Die Feder wird als graue Zickzacklinie dargestellt:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Federbreite</span> <span style="color: #000;">=</span> <span style="color: #008;">6</span> <span style="color: #800; font-style: italic;"># Verändert sich bei Stauchung/Streckung</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Die Windungszahl ist von der Länge abhängig. Die Zacken</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># haben dadurch einen Winkel von etwa 60° zur Federachse.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Wz</span><span style="color: #000;">=</span><span style="color: #808;">max</span><span style="color: black;">&#40;</span><span style="color: #008;">2</span><span style="color: #000;">,</span><span style="color: #808;">int</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">l0</span>/<span style="color: #808;">self</span>.<span style="color: black;">Federbreite</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> update<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #080;">&quot;&quot;&quot;Anpassung der Feder an die neue Lage ihrer Endpunkte&quot;&quot;&quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Lage von P2 zu P1</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        dxy <span style="color: #000;">=</span> <span style="color: #808;">self</span>.<span style="color: black;">x2</span>-<span style="color: #808;">self</span>.<span style="color: black;">x1</span><span style="color: #000;">,</span> <span style="color: #808;">self</span>.<span style="color: black;">y2</span>-<span style="color: #808;">self</span>.<span style="color: black;">y1</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># aktuelle geometrische Länge</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">l</span> <span style="color: #000;">=</span> hypot<span style="color: black;">&#40;</span>*dxy<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># aktuelle Zugkraft </span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        F <span style="color: #000;">=</span> <span style="color: #808;">self</span>.<span style="color: black;">k</span>*<span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">l</span>-<span style="color: #808;">self</span>.<span style="color: black;">l0</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Winkel zwischen P1 und P2 </span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        W <span style="color: #000;">=</span> atan2<span style="color: black;">&#40;</span>*dxy<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># x- und y-Komponente der Kraft</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Fx</span><span style="color: #000;">,</span> <span style="color: #808;">self</span>.<span style="color: black;">Fy</span> <span style="color: #000;">=</span> F*sin<span style="color: black;">&#40;</span>W<span style="color: black;">&#41;</span><span style="color: #000;">,</span> F*cos<span style="color: black;">&#40;</span>W<span style="color: black;">&#41;</span>               </div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Grafik nachführen:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Die Federn bestehen aus einem kurzen geraden Stück</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># am Anfangs- und Endpunkt sowie einer Zickzacklinie dazwischen.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Die Anzahl der Zacken ist so gewählt, dass der Zackenabstand</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># im unbelasteten Zustand der Federbreite entspricht.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Startpunkt der Feder:</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        P<span style="color: #000;">=</span><span style="color: black;">&#91;</span><span style="color: #808;">self</span>.<span style="color: black;">x1</span><span style="color: #000;">,</span> <span style="color: #808;">self</span>.<span style="color: black;">y1</span><span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           <span style="color: #808;">self</span>.<span style="color: black;">x1</span>+<span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x2</span>-<span style="color: #808;">self</span>.<span style="color: black;">x1</span><span style="color: black;">&#41;</span>/<span style="color: #808;">self</span>.<span style="color: black;">Wz</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           <span style="color: #808;">self</span>.<span style="color: black;">y1</span>+<span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">y2</span>-<span style="color: #808;">self</span>.<span style="color: black;">y1</span><span style="color: black;">&#41;</span>/<span style="color: #808;">self</span>.<span style="color: black;">Wz</span><span style="color: black;">&#93;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Abstand der Zacken von der Mittellinie der Feder:</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Die Modifikation der Breite um den Kehrwert der Streckung</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># wirkt nur innerhalb gewisser Grenzen natürlich.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Federn, die wie in dieser &quot;Simulation&quot; um ein Vielfaches</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># ihrer Länge gestreckt werden oder auf eine Länge nahe null</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># zusammengeschoben werden, gibt es ja in der Realität</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># üblicherweise eher nicht so. Wir beschränken die Streckung</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># daher auf das Doppelte bzw. die Hälfte des Grundwertes.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Streckung <span style="color: #000;">=</span> <span style="color: #808;">max</span><span style="color: black;">&#40;</span><span style="color: #008;">0.5</span><span style="color: #000;">,</span><span style="color: #808;">min</span><span style="color: black;">&#40;</span><span style="color: #008;">2</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">l</span>/<span style="color: #808;">self</span>.<span style="color: black;">l0</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Zx <span style="color: #000;">=</span> <span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">y2</span>-<span style="color: #808;">self</span>.<span style="color: black;">y1</span><span style="color: black;">&#41;</span>/<span style="color: #808;">self</span>.<span style="color: black;">l</span>*<span style="color: #808;">self</span>.<span style="color: black;">Federbreite</span>/Streckung</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Zy <span style="color: #000;">=</span> <span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x2</span>-<span style="color: #808;">self</span>.<span style="color: black;">x1</span><span style="color: black;">&#41;</span>/<span style="color: #808;">self</span>.<span style="color: black;">l</span>*<span style="color: #808;">self</span>.<span style="color: black;">Federbreite</span>/Streckung</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Schleife für Zickzacklinie; immer abwechselnd ein Punkt links</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># und rechts von der Mittellinie …</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">for</span> i <span style="color: #ff7700;">in</span> <span style="color: #808;">range</span><span style="color: black;">&#40;</span><span style="color: #008;">2</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">Wz</span>-<span style="color: #008;">2</span><span style="color: #000;">,</span><span style="color: #008;">2</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            P.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x1</span>+i*<span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x2</span>-<span style="color: #808;">self</span>.<span style="color: black;">x1</span><span style="color: black;">&#41;</span>/<span style="color: #808;">self</span>.<span style="color: black;">Wz</span>+Zx<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            P.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">y1</span>+i*<span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">y2</span>-<span style="color: #808;">self</span>.<span style="color: black;">y1</span><span style="color: black;">&#41;</span>/<span style="color: #808;">self</span>.<span style="color: black;">Wz</span>-Zy<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            P.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x1</span>+<span style="color: black;">&#40;</span>i+<span style="color: #008;">1</span><span style="color: black;">&#41;</span>*<span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x2</span>-<span style="color: #808;">self</span>.<span style="color: black;">x1</span><span style="color: black;">&#41;</span>/<span style="color: #808;">self</span>.<span style="color: black;">Wz</span>-Zx<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            P.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">y1</span>+<span style="color: black;">&#40;</span>i+<span style="color: #008;">1</span><span style="color: black;">&#41;</span>*<span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">y2</span>-<span style="color: #808;">self</span>.<span style="color: black;">y1</span><span style="color: black;">&#41;</span>/<span style="color: #808;">self</span>.<span style="color: black;">Wz</span>+Zy<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Zum Schluss die beiden Endpunkte:</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        P.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x2</span>-<span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x2</span>-<span style="color: #808;">self</span>.<span style="color: black;">x1</span><span style="color: black;">&#41;</span>/<span style="color: #808;">self</span>.<span style="color: black;">Wz</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        P.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">y2</span>-<span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">y2</span>-<span style="color: #808;">self</span>.<span style="color: black;">y1</span><span style="color: black;">&#41;</span>/<span style="color: #808;">self</span>.<span style="color: black;">Wz</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        P.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x2</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        P.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">y2</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        C.<span style="color: black;">coords</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">ID</span><span style="color: #000;">,</span>*P<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Soll die Federkraft angezeigt werden?</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">if</span> Einstellungen.<span style="color: black;">Zeige_Federkr</span>äfte:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Wo ist die Mitte der Feder?</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            fmx<span style="color: #000;">,</span> fmy <span style="color: #000;">=</span> <span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x1</span>+<span style="color: #808;">self</span>.<span style="color: black;">x2</span><span style="color: black;">&#41;</span>/<span style="color: #008;">2</span><span style="color: #000;">,</span> <span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">y1</span>+<span style="color: #808;">self</span>.<span style="color: black;">y2</span><span style="color: black;">&#41;</span>/<span style="color: #008;">2</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Wird die Federkraft schon angezeigt?</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">if</span> <span style="color: #808;">self</span>.<span style="color: black;">Kraftanzeige</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                C.<span style="color: black;">itemconfig</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">Kraftanzeige</span><span style="color: #000;">,</span>text<span style="color: #000;">=</span><span style="color: #080;">&quot;%.0f&quot;</span>%F<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                C.<span style="color: black;">coords</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">Kraftanzeige</span><span style="color: #000;">,</span> fmx<span style="color: #000;">,</span> fmy<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">else</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #800; font-style: italic;"># Feder blasser zeichnen, damit der Text besser lesbar ist.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                Grauton <span style="color: #000;">=</span> randint<span style="color: black;">&#40;</span><span style="color: #008;">200</span><span style="color: #000;">,</span><span style="color: #008;">220</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                C.<span style="color: black;">itemconfig</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">ID</span><span style="color: #000;">,</span> fill<span style="color: #000;">=</span><span style="color: #080;">&quot;#&quot;</span>+<span style="color: #008;">3</span>*<span style="color: black;">&#40;</span><span style="color: #080;">&quot;%0X&quot;</span>%Grauton<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #800; font-style: italic;"># Text der Federkraftanzeige erzeugen</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #808;">self</span>.<span style="color: black;">Kraftanzeige</span> <span style="color: #000;">=</span> C.<span style="color: black;">create_text</span><span style="color: black;">&#40;</span>fmx<span style="color: #000;">,</span>fmy<span style="color: #000;">,</span>text<span style="color: #000;">=</span><span style="color: #080;">&quot;%.0f&quot;</span>%F<span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                                  fill<span style="color: #000;">=</span><span style="color: #080;">&quot;black&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                                  font<span style="color: #000;">=</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;Helvetica&quot;</span><span style="color: #000;">,</span><span style="color: #008;">12</span><span style="color: #000;">,</span><span style="color: #080;">&quot;bold&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">else</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Wird die Federkraft immer noch angezeigt?</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">if</span> <span style="color: #808;">self</span>.<span style="color: black;">Kraftanzeige</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #800; font-style: italic;"># Text löschen</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                C.<span style="color: black;">delete</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">Kraftanzeige</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #808;">self</span>.<span style="color: black;">Kraftanzeige</span> <span style="color: #000;">=</span> <span style="color: #808;">None</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #800; font-style: italic;"># Feder wieder kräftiger zeichnen</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                Grauton <span style="color: #000;">=</span> randint<span style="color: black;">&#40;</span><span style="color: #008;">100</span><span style="color: #000;">,</span><span style="color: #008;">200</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                C.<span style="color: black;">itemconfig</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">ID</span><span style="color: #000;">,</span> fill<span style="color: #000;">=</span><span style="color: #080;">&quot;#&quot;</span>+<span style="color: #008;">3</span>*<span style="color: black;">&#40;</span><span style="color: #080;">&quot;%0X&quot;</span>%Grauton<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> set_P<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span>i<span style="color: #000;">,</span>x<span style="color: #000;">,</span>y<span style="color: #000;">,</span>beachteLock<span style="color: #000;">=</span><span style="color: #808;">True</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #080;">&quot;&quot;&quot;Ändert Koordinaten von Punkt P1 oder P2&quot;&quot;&quot;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">if</span> beachteLock:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Stoppschild fürs Multithreading: falls zwei Kugeln</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># gleichzeitig diese Methode aufrufen, muss die zweite</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># hier warten.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #808;">self</span>.<span style="color: black;">Lock</span>.<span style="color: black;">acquire</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">if</span> i <span style="color: #000;">==</span> <span style="color: #008;">1</span>: <span style="color: #800; font-style: italic;"># Punkt 1 der Feder?</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #808;">self</span>.<span style="color: black;">x1</span><span style="color: #000;">,</span> <span style="color: #808;">self</span>.<span style="color: black;">y1</span> <span style="color: #000;">=</span> x<span style="color: #000;">,</span> y</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">else</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #808;">self</span>.<span style="color: black;">x2</span><span style="color: #000;">,</span> <span style="color: #808;">self</span>.<span style="color: black;">y2</span> <span style="color: #000;">=</span> x<span style="color: #000;">,</span> y</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Kräfte durch neue Länge berechnen</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">update</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> </div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">if</span> beachteLock:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Für den Fall, dass eine zweite Kugel warten musste,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># darf diese jetzt auch die Feder beeinflussen:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #808;">self</span>.<span style="color: black;">Lock</span>.<span style="color: black;">release</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> get_F<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span>i<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># In P1 hat die Federkraft ein anderes Vorzeichen als in P2</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">if</span> i <span style="color: #000;">==</span> <span style="color: #008;">1</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">return</span> <span style="color: #808;">self</span>.<span style="color: black;">Fx</span><span style="color: #000;">,</span> <span style="color: #808;">self</span>.<span style="color: black;">Fy</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">else</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">return</span> -<span style="color: #808;">self</span>.<span style="color: black;">Fx</span><span style="color: #000;">,</span> -<span style="color: #808;">self</span>.<span style="color: black;">Fy</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">class</span> Masse:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;&quot;&quot;Ein verschieblicher Massepunkt&quot;&quot;&quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span>x<span style="color: #000;">,</span>y<span style="color: #000;">,</span>r<span style="color: #000;">=</span><span style="color: #008;">10</span><span style="color: #000;">,</span>m<span style="color: #000;">=</span>Einstellungen.<span style="color: black;">Masse</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">x</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span> <span style="color: #000;">=</span> x<span style="color: #000;">,</span>y <span style="color: #800; font-style: italic;"># Mittelpunkt</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">r</span> <span style="color: #000;">=</span> r <span style="color: #800; font-style: italic;"># Radius</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">m</span> <span style="color: #000;">=</span> m <span style="color: #800; font-style: italic;"># Masse</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># ID-Nummer des Kreises auf der Canvas</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">ID</span> <span style="color: #000;">=</span> C.<span style="color: black;">create_oval</span><span style="color: black;">&#40;</span>x-r<span style="color: #000;">,</span>y-r<span style="color: #000;">,</span>x+r<span style="color: #000;">,</span>y+r<span style="color: #000;">,</span>fill <span style="color: #000;">=</span> <span style="color: #080;">&quot;red&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Federn</span> <span style="color: #000;">=</span> <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span> <span style="color: #800; font-style: italic;"># Liste verbundener Federn</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Spur</span> <span style="color: #000;">=</span> <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span> <span style="color: #800; font-style: italic;"># Spuraufzeichnung</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">vx</span> <span style="color: #000;">=</span> <span style="color: #808;">self</span>.<span style="color: black;">vy</span> <span style="color: #000;">=</span> <span style="color: #008;">0</span> <span style="color: #800; font-style: italic;"># Geschwindigkeitskomponenten</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Um die tatsächliche Schrittzeit zu messen, holen wir uns die</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># aktuelle Zeit in Sekunden.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: #dc143c;">time</span> <span style="color: #000;">=</span> perf_counter<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Multithreading: Die Berechnungen aller Massepunkte</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># finden parallel und unabhängig voneinander statt.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Thread</span> <span style="color: #000;">=</span> Thread<span style="color: black;">&#40;</span>target<span style="color: #000;">=</span><span style="color: #808;">self</span>.<span style="color: black;">step</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">stopped</span> <span style="color: #000;">=</span> <span style="color: #808;">False</span> <span style="color: #800; font-style: italic;"># Wird beim Programmende auf True gesetzt.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Thread</span>.<span style="color: black;">start</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #800; font-style: italic;"># Werde lebendig!</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Verbinde den Massepunkt mit dem ersten oder zweiten Anschlusspunkt</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># einer Feder</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> verbinde<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span>Feder<span style="color: #000;">,</span>Anschlusspunkt<span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Federn</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>Feder<span style="color: #000;">,</span>Anschlusspunkt<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Neuer Ort</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> schiebe<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span>x<span style="color: #000;">,</span>y<span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">vx</span> <span style="color: #000;">=</span> <span style="color: #808;">self</span>.<span style="color: black;">vy</span> <span style="color: #000;">=</span> <span style="color: #008;">0</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">x</span><span style="color: #000;">,</span> <span style="color: #808;">self</span>.<span style="color: black;">y</span> <span style="color: #000;">=</span> x<span style="color: #000;">,</span> y</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Ende der Endlosschleife in step()</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> stop<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">stopped</span><span style="color: #000;">=</span><span style="color: #808;">True</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Animation der Kugeln</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> step<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Diese Endlosschleife läuft in einem eigenen Thread</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">while</span> <span style="color: #ff7700;">not</span> <span style="color: #808;">self</span>.<span style="color: black;">stopped</span>: </div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Aktuelle Vergleichszeit in Sekunden holen (als Gleitkommazahl</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># mit ungefähr Mikrosekundengenauigkeit, je nach Betriebssystem)</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            t <span style="color: #000;">=</span> perf_counter<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> </div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Der Zeitschritt dt für die Berechnung entspricht der</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># tatsächlich verstrichenen Zeit seit dem letzten Durchgang.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Zur Vermeidung von Nulldivisionen bei extrem schnellen Rechnern</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># wird ein Mindestwert von einer Mikrosekunde gesetzt.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            dt <span style="color: #000;">=</span> <span style="color: #808;">max</span><span style="color: black;">&#40;</span><span style="color: #008;">0.000001</span><span style="color: #000;">,</span>t-<span style="color: #808;">self</span>.<span style="color: #dc143c;">time</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Gelesene Zeit bis zum nächsten Aufruf merken</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #808;">self</span>.<span style="color: #dc143c;">time</span> <span style="color: #000;">=</span> t </div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Gleitende Ermittlung der Physikschritte pro Sekunde</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># über die letzten 200 Durchläufe:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            Einstellungen.<span style="color: black;">PPS</span> <span style="color: #000;">=</span> Einstellungen.<span style="color: black;">PPS</span>*<span style="color: #008;">0.995</span> + <span style="color: #008;">0.005</span>/dt</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Resultierende Kraft der angeschlossenen Federn addieren:</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            Fx <span style="color: #000;">=</span> Fy <span style="color: #000;">=</span> <span style="color: #008;">0</span> </div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">for</span> Feder<span style="color: #000;">,</span> Punkt <span style="color: #ff7700;">in</span> <span style="color: #808;">self</span>.<span style="color: black;">Federn</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                dFx<span style="color: #000;">,</span> dFy <span style="color: #000;">=</span> Feder.<span style="color: black;">get_F</span><span style="color: black;">&#40;</span>Punkt<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                Fx +<span style="color: #000;">=</span> dFx</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                Fy +<span style="color: #000;">=</span> dFy</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Dämpfung: 1 == keine Dämpfung, 0.01 == maximale Dämpfung</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            D <span style="color: #000;">=</span> <span style="color: black;">&#40;</span><span style="color: #008;">1</span>-<span style="color: #808;">min</span><span style="color: black;">&#40;</span><span style="color: #008;">0.99</span><span style="color: #000;">,</span>dt*Einstellungen.<span style="color: black;">D</span>ämpfung**<span style="color: #008;">2</span>/<span style="color: #008;">100</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Neue Geschwindigkeit</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #808;">self</span>.<span style="color: black;">vx</span> <span style="color: #000;">=</span> <span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">vx</span>+Fx/<span style="color: #808;">self</span>.<span style="color: black;">m</span>*dt<span style="color: black;">&#41;</span>*D</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #808;">self</span>.<span style="color: black;">vy</span> <span style="color: #000;">=</span> <span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">vy</span>+<span style="color: black;">&#40;</span>Fy/<span style="color: #808;">self</span>.<span style="color: black;">m</span>+Einstellungen.<span style="color: black;">Gravitation</span>*<span style="color: #008;">100</span><span style="color: black;">&#41;</span>*dt<span style="color: black;">&#41;</span>*D</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Neuer Ort</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #808;">self</span>.<span style="color: black;">x</span> +<span style="color: #000;">=</span> <span style="color: #808;">self</span>.<span style="color: black;">vx</span> * dt</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #808;">self</span>.<span style="color: black;">y</span> +<span style="color: #000;">=</span> <span style="color: #808;">self</span>.<span style="color: black;">vy</span> * dt</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Grafik aktualisieren</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            C.<span style="color: black;">coords</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">ID</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">x</span>-<span style="color: #808;">self</span>.<span style="color: black;">r</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span>-<span style="color: #808;">self</span>.<span style="color: black;">r</span><span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                     <span style="color: #808;">self</span>.<span style="color: black;">x</span>+<span style="color: #808;">self</span>.<span style="color: black;">r</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span>+<span style="color: #808;">self</span>.<span style="color: black;">r</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Federn hinterherziehen</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">for</span> Feder<span style="color: #000;">,</span>Punkt <span style="color: #ff7700;">in</span> <span style="color: #808;">self</span>.<span style="color: black;">Federn</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                Feder.<span style="color: black;">set_P</span><span style="color: black;">&#40;</span>Punkt<span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">x</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Soll Spurlinie gezeichnet werden?</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">if</span> Einstellungen.<span style="color: black;">Zeige_Spur</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #800; font-style: italic;"># Gibt es schon eine Spurlinie?</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #ff7700;">if</span> <span style="color: #808;">self</span>.<span style="color: black;">Spur</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #800; font-style: italic;"># Wenn sich die Kugel ein Stück bewegt hat, (z. B. um</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #800; font-style: italic;"># einen Kugelradius), wird die Spurlinie um</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #800; font-style: italic;"># einen Punkt verlängert.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #ff7700;">if</span> hypot<span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x</span>-<span style="color: #808;">self</span>.<span style="color: black;">Spur</span><span style="color: black;">&#91;</span>-<span style="color: #008;">2</span><span style="color: black;">&#93;</span><span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                             <span style="color: #808;">self</span>.<span style="color: black;">y</span>-<span style="color: #808;">self</span>.<span style="color: black;">Spur</span><span style="color: black;">&#91;</span>-<span style="color: #008;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> <span style="color: #000;">&gt;</span> <span style="color: #808;">self</span>.<span style="color: black;">r</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                        <span style="color: #808;">self</span>.<span style="color: black;">Spur</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                        <span style="color: #808;">self</span>.<span style="color: black;">Spur</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">y</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                        C.<span style="color: black;">coords</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">Spur</span><span style="color: black;">&#91;</span><span style="color: #008;">0</span><span style="color: black;">&#93;</span><span style="color: #000;">,</span>*<span style="color: #808;">self</span>.<span style="color: black;">Spur</span><span style="color: black;">&#91;</span><span style="color: #008;">1</span>:<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #800; font-style: italic;"># Sonst neue Spurlinie anlegen</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #ff7700;">else</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #800; font-style: italic;"># Linienfarbe soll irgendein Grünton sein</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    r <span style="color: #000;">=</span> randint<span style="color: black;">&#40;</span><span style="color: #008;">0</span><span style="color: #000;">,</span><span style="color: #008;">150</span><span style="color: black;">&#41;</span> <span style="color: #800; font-style: italic;"># bisschen rot …</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    b <span style="color: #000;">=</span> randint<span style="color: black;">&#40;</span><span style="color: #008;">0</span><span style="color: #000;">,</span><span style="color: #008;">150</span><span style="color: black;">&#41;</span> <span style="color: #800; font-style: italic;"># bisschen blau …</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    g <span style="color: #000;">=</span> randint<span style="color: black;">&#40;</span><span style="color: #808;">max</span><span style="color: black;">&#40;</span>r<span style="color: #000;">,</span>b<span style="color: black;">&#41;</span><span style="color: #000;">,</span><span style="color: #008;">255</span><span style="color: black;">&#41;</span> <span style="color: #800; font-style: italic;"># … mehr grün</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    grünlich <span style="color: #000;">=</span> <span style="color: #080;">&quot;#%02x%02x%02x&quot;</span>%<span style="color: black;">&#40;</span>r<span style="color: #000;">,</span>g<span style="color: #000;">,</span>b<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #800; font-style: italic;"># Das erste Listenelement ist die Canvas-ID, danach</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #800; font-style: italic;"># folgen die einzelnen Punkte der Spurlinie. Der erste</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #800; font-style: italic;"># Punkt ist doppelt vorhanden, weil eine Linie aus</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #800; font-style: italic;"># mindestens zwei Punkten bestehen muss.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #808;">self</span>.<span style="color: black;">Spur</span><span style="color: #000;">=</span><span style="color: black;">&#91;</span>C.<span style="color: black;">create_line</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span><span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                             <span style="color: #808;">self</span>.<span style="color: black;">x</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                             fill<span style="color: #000;">=</span>grünlich<span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                             <span style="color: black;">&#41;</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                               <span style="color: #808;">self</span>.<span style="color: black;">x</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span><span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                               <span style="color: #808;">self</span>.<span style="color: black;">x</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                               <span style="color: black;">&#93;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #800; font-style: italic;"># Die Spur soll auf der Canvas ganz unten liegen, um nichts</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #800; font-style: italic;"># zu verdecken.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    C.<span style="color: black;">tag_lower</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">Spur</span><span style="color: black;">&#91;</span><span style="color: #008;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Spurlinie soll nicht gezeichnet werden:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">else</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #ff7700;">if</span> <span style="color: #808;">self</span>.<span style="color: black;">Spur</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #800; font-style: italic;"># Weg damit!</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    C.<span style="color: black;">delete</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">Spur</span><span style="color: black;">&#91;</span><span style="color: #008;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #808;">self</span>.<span style="color: black;">Spur</span><span style="color: #000;">=</span><span style="color: black;">&#91;</span><span style="color: black;">&#93;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Nicht zu schnell werden …</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># der maximale CPU-Anteil für diesen Thread wird mit wachsender</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Kugelzahl geringer.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            sleep<span style="color: black;">&#40;</span>dt*<span style="color: black;">&#40;</span><span style="color: #008;">1</span>-<span style="color: #008;">1</span>/<span style="color: #808;">len</span><span style="color: black;">&#40;</span>Masse_Elemente<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span> </div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Markierung beim Zeichnen neuer Federn</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> markiere<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span>einschalten<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">if</span> einschalten:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            R <span style="color: #000;">=</span> <span style="color: #808;">self</span>.<span style="color: black;">r</span>*<span style="color: #008;">1.5</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #808;">self</span>.<span style="color: black;">markID</span> <span style="color: #000;">=</span> C.<span style="color: black;">create_oval</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x</span>-R<span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span>-R<span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                        <span style="color: #808;">self</span>.<span style="color: black;">x</span>+R<span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span>+R<span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                        width<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: #000;">,</span>outline<span style="color: #000;">=</span><span style="color: #080;">&quot;green&quot;</span><span style="color: #000;">,</span>dash<span style="color: #000;">=</span><span style="color: black;">&#40;</span><span style="color: #008;">10</span><span style="color: #000;">,</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">else</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            C.<span style="color: black;">delete</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">markID</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">class</span> Lager:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;&quot;&quot;Festes Auflager&quot;&quot;&quot;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span>x<span style="color: #000;">,</span>y<span style="color: #000;">,</span>r<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">x</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span> <span style="color: #000;">=</span> x<span style="color: #000;">,</span>y <span style="color: #800; font-style: italic;"># Mittelpunkt</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">r</span> <span style="color: #000;">=</span> r <span style="color: #800; font-style: italic;"># Radius</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">ID</span> <span style="color: #000;">=</span> C.<span style="color: black;">create_oval</span><span style="color: black;">&#40;</span>x-r<span style="color: #000;">,</span>y-r<span style="color: #000;">,</span>x+r<span style="color: #000;">,</span>y+r<span style="color: #000;">,</span>fill<span style="color: #000;">=</span><span style="color: #080;">&quot;blue&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Federn</span> <span style="color: #000;">=</span> <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span> <span style="color: #800; font-style: italic;"># Liste verbundener Federn</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">F</span> <span style="color: #000;">=</span> <span style="color: #008;">0</span> <span style="color: #800; font-style: italic;"># resultierende Auflagerkraft</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Auflagerkraft_angezeigt</span> <span style="color: #000;">=</span> <span style="color: #808;">False</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">step</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #800; font-style: italic;"># Für die Animation der Lagerkräfte</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Verbinde Lager mit dem ersten oder zweiten Punkt einer Feder</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> verbinde<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span>Feder<span style="color: #000;">,</span>Punkt<span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Federn</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>Feder<span style="color: #000;">,</span>Punkt<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Neuer Ort</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> schiebe<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span>x<span style="color: #000;">,</span>y<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">x</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span> <span style="color: #000;">=</span> x<span style="color: #000;">,</span>y</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Punkt auf der Canvas verschieben:</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        C.<span style="color: black;">coords</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">ID</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">x</span>-<span style="color: #808;">self</span>.<span style="color: black;">r</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span>-<span style="color: #808;">self</span>.<span style="color: black;">r</span><span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                 <span style="color: #808;">self</span>.<span style="color: black;">x</span>+<span style="color: #808;">self</span>.<span style="color: black;">r</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span>+<span style="color: #808;">self</span>.<span style="color: black;">r</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Angeschlossene Federn nachziehen:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Das Multithreading-Lock in Feder.set_P, das verhindern soll,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># dass zwei Kugeln gleichzeitig auf eine Feder zugreifen, darf</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># hier nicht greifen, sonst blockiert das Programm.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">for</span> Feder<span style="color: #000;">,</span>Punkt <span style="color: #ff7700;">in</span> <span style="color: #808;">self</span>.<span style="color: black;">Federn</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            Feder.<span style="color: black;">set_P</span><span style="color: black;">&#40;</span>Punkt<span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">x</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span><span style="color: #000;">,</span>beachteLock<span style="color: #000;">=</span><span style="color: #808;">False</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Markierung beim Zeichnen neuer Federn</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> markiere<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span>einschalten<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">if</span> einschalten:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            R <span style="color: #000;">=</span> <span style="color: #808;">self</span>.<span style="color: black;">r</span>*<span style="color: #008;">1.5</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #808;">self</span>.<span style="color: black;">markID</span> <span style="color: #000;">=</span> C.<span style="color: black;">create_oval</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x</span>-R<span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span>-R<span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                        <span style="color: #808;">self</span>.<span style="color: black;">x</span>+R<span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">y</span>+R<span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                        width<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: #000;">,</span>outline<span style="color: #000;">=</span><span style="color: #080;">&quot;green&quot;</span><span style="color: #000;">,</span>dash<span style="color: #000;">=</span><span style="color: black;">&#40;</span><span style="color: #008;">10</span><span style="color: #000;">,</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">else</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            C.<span style="color: black;">delete</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">markID</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Anzeige der Lagerkräfte:</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> step<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Soll die Auflagerkraft überhaupt angezeigt werden?</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">if</span> Einstellungen.<span style="color: black;">Zeige_Auflagerkr</span>äfte:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Summe der auf das Lager wirkenden Kräfte bilden</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            Fx <span style="color: #000;">=</span> Fy <span style="color: #000;">=</span> <span style="color: #008;">0</span> </div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">for</span> Feder<span style="color: #000;">,</span>Punkt <span style="color: #ff7700;">in</span> <span style="color: #808;">self</span>.<span style="color: black;">Federn</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                dFx<span style="color: #000;">,</span> dFy <span style="color: #000;">=</span> Feder.<span style="color: black;">get_F</span><span style="color: black;">&#40;</span>Punkt<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                Fx +<span style="color: #000;">=</span> dFx</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                Fy +<span style="color: #000;">=</span> dFy</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Resultierende Kraft ausrechnen</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #808;">self</span>.<span style="color: black;">F</span> <span style="color: #000;">=</span> hypot<span style="color: black;">&#40;</span>Fx<span style="color: #000;">,</span>Fy<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Skalierung für eine freundliche Darstellungsgröße;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Die größte Auflagerkraft erhält die Länge 100.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            max_abs_F <span style="color: #000;">=</span> <span style="color: #008;">1</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">for</span> E <span style="color: #ff7700;">in</span> Lager_Elemente:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                max_abs_F <span style="color: #000;">=</span> <span style="color: #808;">max</span><span style="color: black;">&#40;</span>max_abs_F<span style="color: #000;">,</span> E.<span style="color: black;">F</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            F_Skalierung <span style="color: #000;">=</span> <span style="color: #008;">100</span> / max_abs_F</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Position des Textes</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            x_F <span style="color: #000;">=</span> <span style="color: #808;">self</span>.<span style="color: black;">x</span> + Fx * F_Skalierung</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            y_F <span style="color: #000;">=</span> <span style="color: #808;">self</span>.<span style="color: black;">y</span> + Fy * F_Skalierung</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Endpunkte des Kraftpfeils</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            x1_P <span style="color: #000;">=</span> <span style="color: #808;">self</span>.<span style="color: black;">x</span> + <span style="color: #808;">self</span>.<span style="color: black;">r</span> * Fx/<span style="color: #808;">self</span>.<span style="color: black;">F</span> <span style="color: #ff7700;">if</span> <span style="color: #808;">self</span>.<span style="color: black;">F</span> <span style="color: #000;">!=</span><span style="color: #008;">0</span> <span style="color: #ff7700;">else</span> <span style="color: #808;">self</span>.<span style="color: black;">x</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            y1_P <span style="color: #000;">=</span> <span style="color: #808;">self</span>.<span style="color: black;">y</span> + <span style="color: #808;">self</span>.<span style="color: black;">r</span> * Fy/<span style="color: #808;">self</span>.<span style="color: black;">F</span> <span style="color: #ff7700;">if</span> <span style="color: #808;">self</span>.<span style="color: black;">F</span> <span style="color: #000;">!=</span><span style="color: #008;">0</span> <span style="color: #ff7700;">else</span> <span style="color: #808;">self</span>.<span style="color: black;">y</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            x2_P <span style="color: #000;">=</span> <span style="color: #808;">self</span>.<span style="color: black;">x</span> + <span style="color: #008;">0.9</span> * <span style="color: black;">&#40;</span>x_F-<span style="color: #808;">self</span>.<span style="color: black;">x</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            y2_P <span style="color: #000;">=</span> <span style="color: #808;">self</span>.<span style="color: black;">y</span> + <span style="color: #008;">0.9</span> * <span style="color: black;">&#40;</span>y_F-<span style="color: #808;">self</span>.<span style="color: black;">y</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Wird die Auflagerkraft schon angezeigt?</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">if</span> <span style="color: #808;">self</span>.<span style="color: black;">Auflagerkraft_angezeigt</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                C.<span style="color: black;">itemconfig</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">AT_ID</span><span style="color: #000;">,</span>text<span style="color: #000;">=</span><span style="color: #080;">&quot;%.0f&quot;</span>%<span style="color: #808;">self</span>.<span style="color: black;">F</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                C.<span style="color: black;">coords</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">AT_ID</span><span style="color: #000;">,</span>x_F<span style="color: #000;">,</span>y_F<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                C.<span style="color: black;">coords</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">AP_ID</span><span style="color: #000;">,</span>x1_P<span style="color: #000;">,</span>y1_P<span style="color: #000;">,</span>x2_P<span style="color: #000;">,</span>y2_P<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">else</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #808;">self</span>.<span style="color: black;">AP_ID</span> <span style="color: #000;">=</span> C.<span style="color: black;">create_line</span><span style="color: black;">&#40;</span>x1_P<span style="color: #000;">,</span>y1_P<span style="color: #000;">,</span>x2_P<span style="color: #000;">,</span>y2_P<span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                           arrow<span style="color: #000;">=</span><span style="color: #080;">&quot;first&quot;</span><span style="color: #000;">,</span>arrowshape<span style="color: #000;">=</span><span style="color: black;">&#40;</span><span style="color: #008;">10</span><span style="color: #000;">,</span><span style="color: #008;">12</span><span style="color: #000;">,</span><span style="color: #008;">6</span><span style="color: black;">&#41;</span><span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                           width<span style="color: #000;">=</span><span style="color: #008;">3</span><span style="color: #000;">,</span>fill<span style="color: #000;">=</span><span style="color: #080;">&quot;blue&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #808;">self</span>.<span style="color: black;">AT_ID</span> <span style="color: #000;">=</span> C.<span style="color: black;">create_text</span><span style="color: black;">&#40;</span>x_F<span style="color: #000;">,</span>y_F<span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                           text<span style="color: #000;">=</span><span style="color: #080;">&quot;%.0f&quot;</span>%<span style="color: #808;">self</span>.<span style="color: black;">F</span><span style="color: #000;">,</span>fill<span style="color: #000;">=</span><span style="color: #080;">&quot;black&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                           font<span style="color: #000;">=</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;Helvetica&quot;</span><span style="color: #000;">,</span><span style="color: #008;">12</span><span style="color: #000;">,</span><span style="color: #080;">&quot;bold&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #808;">self</span>.<span style="color: black;">Auflagerkraft_angezeigt</span> <span style="color: #000;">=</span> <span style="color: #808;">True</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">else</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Wird sie immer noch angezeigt?</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">if</span> <span style="color: #808;">self</span>.<span style="color: black;">Auflagerkraft_angezeigt</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                C.<span style="color: black;">delete</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">AT_ID</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                C.<span style="color: black;">delete</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">AP_ID</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #808;">self</span>.<span style="color: black;">Auflagerkraft_angezeigt</span> <span style="color: #000;">=</span> <span style="color: #808;">False</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Bis gleich …</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        T.<span style="color: black;">after</span><span style="color: black;">&#40;</span><span style="color: #008;">40</span><span style="color: #000;">,</span><span style="color: #808;">self</span>.<span style="color: black;">step</span><span style="color: black;">&#41;</span> <span style="color: #800; font-style: italic;"># 40 ms; 1/25 s</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Nicht zu oft; 25 mal pro Sekunde ist mehr als genug.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Wer mag, kann die beiden Klassen „Lager“ und „Masse“ auch von einer</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># neu anzulegenden Klasse „Verschieblicher_Punkt“ ableiten, damit oben</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># keine Redundanzen auftreten.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Geometrie und Zusammenhänge einer Beispielzusammenstellung:</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Variante 1: „Hampelmann“</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##L1 = Lager(300,100)</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##L2 = Lager(500,100)</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##L3 = Lager(200,600)</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##L4 = Lager(600,600)</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##M1 = Masse(400,200)</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##M2 = Masse(400,300)</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##F1 = Feder(L1,M1)</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##F2 = Feder(L2,M1)</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##F3 = Feder(M2,M1)</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##F4 = Feder(M2,L3)</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##F5 = Feder(M2,L4)</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##Masse_Elemente = [M1,M2]</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##Lager_Elemente = [L1,L2,L3,L4]</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##Verschiebliche_Elemente = [M1,M2,L1,L2,L3,L4]</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">##Abhängige_Elemente = [F1,F2,F3,F4,F5]</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Variante 2: „Minimalistisch“</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">L1 <span style="color: #000;">=</span> Lager<span style="color: black;">&#40;</span><span style="color: #008;">400</span><span style="color: #000;">,</span><span style="color: #008;">100</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">M1 <span style="color: #000;">=</span> Masse<span style="color: black;">&#40;</span><span style="color: #008;">400</span><span style="color: #000;">,</span><span style="color: #008;">200</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">F1 <span style="color: #000;">=</span> Feder<span style="color: black;">&#40;</span>L1<span style="color: #000;">,</span>M1<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Masse_Elemente <span style="color: #000;">=</span> <span style="color: black;">&#91;</span>M1<span style="color: black;">&#93;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Lager_Elemente <span style="color: #000;">=</span> <span style="color: black;">&#91;</span>L1<span style="color: black;">&#93;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Verschiebliche_Elemente <span style="color: #000;">=</span> <span style="color: black;">&#91;</span>M1<span style="color: #000;">,</span>L1<span style="color: black;">&#93;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Abhängige_Elemente <span style="color: #000;">=</span> <span style="color: black;">&#91;</span>F1<span style="color: black;">&#93;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">#</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Interaktionsteil</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">#</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Die vorhandenen Massen und Lager können durch Anklicken und Ziehen</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># verschoben werden.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Welches ist das zur Position x,y nächstliegende Objekt?</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> NächstesElement<span style="color: black;">&#40;</span>x<span style="color: #000;">,</span>y<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    a_min <span style="color: #000;">=</span> <span style="color: #008;">1E10</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">for</span> i<span style="color: #000;">,</span>E <span style="color: #ff7700;">in</span> <span style="color: #808;">enumerate</span><span style="color: black;">&#40;</span>Verschiebliche_Elemente<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        a <span style="color: #000;">=</span> hypot<span style="color: black;">&#40;</span>x-E.<span style="color: black;">x</span><span style="color: #000;">,</span>y-E.<span style="color: black;">y</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">if</span> a<span style="color: #000;">&lt;</span>a_min:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            a_min<span style="color: #000;">=</span>a</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            i_min<span style="color: #000;">=</span>i</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">return</span> Verschiebliche_Elemente<span style="color: black;">&#91;</span>i_min<span style="color: black;">&#93;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Verschiebe das dem Mauszeiger am nächsten liegende Objekt</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">class</span> dragdrop:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;&quot;&quot;Merkt sich das gerade zu verschiebende Objekt&quot;&quot;&quot;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    E <span style="color: #000;">=</span> <span style="color: #808;">None</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> drag<span style="color: black;">&#40;</span>event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;&quot;&quot;Klicken und Ziehen&quot;&quot;&quot;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">if</span> <span style="color: #ff7700;">not</span> dragdrop.<span style="color: black;">E</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        dragdrop.<span style="color: black;">E</span> <span style="color: #000;">=</span> NächstesElement<span style="color: black;">&#40;</span>event.<span style="color: black;">x</span><span style="color: #000;">,</span>event.<span style="color: black;">y</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        C.<span style="color: black;">config</span><span style="color: black;">&#40;</span>cursor<span style="color: #000;">=</span><span style="color: #080;">&quot;fleur&quot;</span><span style="color: black;">&#41;</span> <span style="color: #800; font-style: italic;"># Wird als zugreifende Hand dargestellt</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    dragdrop.<span style="color: black;">E</span>.<span style="color: black;">schiebe</span><span style="color: black;">&#40;</span>event.<span style="color: black;">x</span><span style="color: #000;">,</span>event.<span style="color: black;">y</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> drop<span style="color: black;">&#40;</span>event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;&quot;&quot;Loslassen&quot;&quot;&quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">if</span> dragdrop.<span style="color: black;">E</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        dragdrop.<span style="color: black;">E</span> <span style="color: #000;">=</span> <span style="color: #808;">None</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        C.<span style="color: black;">config</span><span style="color: black;">&#40;</span>cursor<span style="color: #000;">=</span><span style="color: #080;">&quot;&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Erzeuge einen neuen Massepunkt und verbinde ihn (nur bei vorhandener</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Gravitation) mit dem nächsten Element, damit er nicht herunterfällt.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> neueMasse<span style="color: black;">&#40;</span>event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    M <span style="color: #000;">=</span> Masse<span style="color: black;">&#40;</span>event.<span style="color: black;">x</span><span style="color: #000;">,</span>event.<span style="color: black;">y</span><span style="color: #000;">,</span>m<span style="color: #000;">=</span>Einstellungen.<span style="color: black;">Masse</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">if</span> Einstellungen.<span style="color: black;">Gravitation</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        E <span style="color: #000;">=</span> NächstesElement<span style="color: black;">&#40;</span>event.<span style="color: black;">x</span><span style="color: #000;">,</span>event.<span style="color: black;">y</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        F <span style="color: #000;">=</span> Feder<span style="color: black;">&#40;</span>E<span style="color: #000;">,</span>M<span style="color: #000;">,</span>Einstellungen.<span style="color: black;">Federsteifigkeit</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Abhängige_Elemente.<span style="color: black;">append</span><span style="color: black;">&#40;</span>F<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Masse_Elemente.<span style="color: black;">append</span><span style="color: black;">&#40;</span>M<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Verschiebliche_Elemente.<span style="color: black;">append</span><span style="color: black;">&#40;</span>M<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Erzeuge neues Lager</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> neuesLager<span style="color: black;">&#40;</span>event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    L <span style="color: #000;">=</span> Lager<span style="color: black;">&#40;</span>event.<span style="color: black;">x</span><span style="color: #000;">,</span>event.<span style="color: black;">y</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Lager_Elemente.<span style="color: black;">append</span><span style="color: black;">&#40;</span>L<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Verschiebliche_Elemente.<span style="color: black;">append</span><span style="color: black;">&#40;</span>L<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Erzeuge eine neue Feder in zwei Schritten durch die Auswahl eines</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Start- und eines Zielelements. Jeweils das dem Mauszeiger am nächsten</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># liegende Objekt wird ausgewählt.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">class</span> Federstatus:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;&quot;&quot;Zur Speicherung des Startelements einer neuen Feder&quot;&quot;&quot;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Startelement <span style="color: #000;">=</span> <span style="color: #808;">None</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> neueFeder<span style="color: black;">&#40;</span>event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;&quot;&quot;Erzeugt neue Feder vom Start- zum Zielobjekt&quot;&quot;&quot;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    E <span style="color: #000;">=</span> NächstesElement<span style="color: black;">&#40;</span>event.<span style="color: black;">x</span><span style="color: #000;">,</span>event.<span style="color: black;">y</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Gibt es noch kein Startelement? -&gt; neue Feder</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">if</span> <span style="color: #ff7700;">not</span> Federstatus.<span style="color: black;">Startelement</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Wir markieren das Element, von dem die Feder ausgehen soll.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        E.<span style="color: black;">markiere</span><span style="color: black;">&#40;</span><span style="color: #808;">True</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Außerdem merken wir uns dieses Element für später …</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Federstatus.<span style="color: black;">Startelement</span> <span style="color: #000;">=</span> E</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">else</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># … also für jetzt ;-)</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Das ist doch jetzt wirklich ein anderes Element als vorhin, oder?</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">if</span> E <span style="color: #000;">!=</span> Federstatus.<span style="color: black;">Startelement</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Dann her mit der Feder!</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            F <span style="color: #000;">=</span> Feder<span style="color: black;">&#40;</span>Federstatus.<span style="color: black;">Startelement</span><span style="color: #000;">,</span>E<span style="color: #000;">,</span>Einstellungen.<span style="color: black;">Federsteifigkeit</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            Abhängige_Elemente.<span style="color: black;">append</span><span style="color: black;">&#40;</span>F<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Die Markierung kann wieder weg</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Federstatus.<span style="color: black;">Startelement</span>.<span style="color: black;">markiere</span><span style="color: black;">&#40;</span><span style="color: #808;">False</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Federstatus.<span style="color: black;">Startelement</span> <span style="color: #000;">=</span> <span style="color: #808;">None</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> Rechtsklick<span style="color: black;">&#40;</span>event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;&quot;&quot;Entspricht dem Drücken der Tasten „M“, „L“ oder „F“&quot;&quot;&quot;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">if</span> RR_Variable.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #000;">==</span><span style="color: #080;">&quot;M&quot;</span>: neueMasse<span style="color: black;">&#40;</span>event<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">elif</span> RR_Variable.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #000;">==</span><span style="color: #080;">&quot;L&quot;</span>: neuesLager<span style="color: black;">&#40;</span>event<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">elif</span> RR_Variable.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #000;">==</span><span style="color: #080;">&quot;F&quot;</span>: neueFeder<span style="color: black;">&#40;</span>event<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Geordnetes Beenden der ganzen parallel laufenden Threads.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Wenn wir uns nicht darum kümmern, gibt es unästhetische Fehlermeldungen</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># wie z.B. _tkinter.TclError: invalid command name “.4302957584”</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> Canvasschließen<span style="color: black;">&#40;</span>event<span style="color: #000;">=</span><span style="color: #808;">None</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Im Moment laufen alle Kugeln in ihren eigenen</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Endlosschleifen. Wir teilen ihnen mit, dass sie diese</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># doch jetzt bitte bald mal beenden sollen.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">for</span> E <span style="color: #ff7700;">in</span> Masse_Elemente:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        E.<span style="color: black;">stop</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Wir geben ihnen noch reichlich Zeit …</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    sleep<span style="color: black;">&#40;</span><span style="color: #008;">0.1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    TE.<span style="color: black;">destroy</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #800; font-style: italic;"># Schon mal das Einstellungsfenster schließen …</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># … noch ein ganz kleines Päuschen …</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    sleep<span style="color: black;">&#40;</span><span style="color: #008;">0.1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># … letzte Aufräumarbeiten auf der Canvas …</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    T.<span style="color: black;">update</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># … und weg!</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    T.<span style="color: black;">destroy</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #800; font-style: italic;"># Jetzt auch das Canvasfenster schließen.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">########## Event-Bindungen im Canvas-Fenster #############</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">C.<span style="color: black;">bind</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;&lt;B1-Motion&gt;&quot;</span><span style="color: #000;">,</span>drag<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">C.<span style="color: black;">bind</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;&lt;ButtonRelease-1&gt;&quot;</span><span style="color: #000;">,</span>drop<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">C.<span style="color: black;">bind</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;&lt;Button-3&gt;&quot;</span><span style="color: #000;">,</span>Rechtsklick<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">T.<span style="color: black;">bind</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;m&quot;</span><span style="color: #000;">,</span>neueMasse<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">T.<span style="color: black;">bind</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;l&quot;</span><span style="color: #000;">,</span>neuesLager<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">T.<span style="color: black;">bind</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;f&quot;</span><span style="color: #000;">,</span>neueFeder<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">T.<span style="color: black;">bind</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;&lt;F1&gt;&quot;</span><span style="color: #000;">,</span>Hilfe<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">T.<span style="color: black;">protocol</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;WM_DELETE_WINDOW&quot;</span><span style="color: #000;">,</span> Canvasschließen<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">########### Einstellungen-Fenster ###########</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">TE <span style="color: #000;">=</span> Toplevel<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">TE.<span style="color: black;">title</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;Einstellungen&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">TE.<span style="color: black;">bind</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;&lt;F1&gt;&quot;</span><span style="color: #000;">,</span>Hilfe<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">TE.<span style="color: black;">protocol</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;WM_DELETE_WINDOW&quot;</span><span style="color: #000;">,</span> Canvasschließen<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Die Gridzeile 0 mit dem Reglerpult soll sich in</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># der Größe anpassen, wenn das Fenster vergrößert wird.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">TE.<span style="color: black;">rowconfigure</span><span style="color: black;">&#40;</span><span style="color: #008;">0</span><span style="color: #000;">,</span>weight<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Die 2 Spalten des Hauptfensters sollen sich gleichmäßig verteilen können.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">TE.<span style="color: black;">columnconfigure</span><span style="color: black;">&#40;</span><span style="color: #008;">0</span><span style="color: #000;">,</span>weight<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">TE.<span style="color: black;">columnconfigure</span><span style="color: black;">&#40;</span><span style="color: #008;">1</span><span style="color: #000;">,</span>weight<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Das Reglerpult</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SLF <span style="color: #000;">=</span> LabelFrame<span style="color: black;">&#40;</span>TE<span style="color: #000;">,</span>text<span style="color: #000;">=</span><span style="color: #080;">&quot;Reglerpult:&quot;</span><span style="color: #000;">,</span>padx<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: #000;">,</span>pady<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SLF.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span>columnspan<span style="color: #000;">=</span><span style="color: #008;">2</span><span style="color: #000;">,</span>sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;wens&quot;</span><span style="color: #000;">,</span>padx<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: #000;">,</span>pady<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Zeile 1 im Labelframe (die Regler) soll dessen Größenanpassung übernehmen,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># außerdem soll sie mindestens 200 Pixel hoch sein, damit die</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Skalenzahlen gut zu erkennen sind.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SLF.<span style="color: black;">rowconfigure</span><span style="color: black;">&#40;</span><span style="color: #008;">1</span><span style="color: #000;">,</span>weight<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span>minsize<span style="color: #000;">=</span><span style="color: #008;">200</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Die 4 Spalten sollen sich gleichmäßig verteilen können.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SLF.<span style="color: black;">columnconfigure</span><span style="color: black;">&#40;</span><span style="color: #008;">0</span><span style="color: #000;">,</span>weight<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SLF.<span style="color: black;">columnconfigure</span><span style="color: black;">&#40;</span><span style="color: #008;">1</span><span style="color: #000;">,</span>weight<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SLF.<span style="color: black;">columnconfigure</span><span style="color: black;">&#40;</span><span style="color: #008;">2</span><span style="color: #000;">,</span>weight<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SLF.<span style="color: black;">columnconfigure</span><span style="color: black;">&#40;</span><span style="color: #008;">3</span><span style="color: #000;">,</span>weight<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Schieberegler Gravitation</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Label<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span>text<span style="color: #000;">=</span><span style="color: #080;">&quot;Gravitation&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> SG_command<span style="color: black;">&#40;</span>event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Einstellungen.<span style="color: black;">Gravitation</span> <span style="color: #000;">=</span> SG.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SG <span style="color: #000;">=</span> Scale<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span> from_<span style="color: #000;">=</span>-<span style="color: #008;">2</span><span style="color: #000;">,</span> to<span style="color: #000;">=</span><span style="color: #008;">20</span><span style="color: #000;">,</span> width<span style="color: #000;">=</span><span style="color: #008;">20</span><span style="color: #000;">,</span> orient<span style="color: #000;">=</span><span style="color: #080;">&quot;vertical&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           tickinterval<span style="color: #000;">=</span><span style="color: #008;">2</span><span style="color: #000;">,</span> resolution<span style="color: #000;">=</span><span style="color: #008;">0.01</span><span style="color: #000;">,</span> command<span style="color: #000;">=</span>SG_command<span style="color: black;">&#41;</span> </div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SG.<span style="color: #808;">set</span><span style="color: black;">&#40;</span>Einstellungen.<span style="color: black;">Gravitation</span><span style="color: black;">&#41;</span> <span style="color: #800; font-style: italic;"># Anfangswert des Reglers: 9.81</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SG.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span>sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;nsew&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Schieberegler Federsteifigkeit</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Label<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span>text<span style="color: #000;">=</span><span style="color: #080;">&quot;Feder-nsteifigkeit&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> SF_command<span style="color: black;">&#40;</span>event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Einstellungen.<span style="color: black;">Federsteifigkeit</span> <span style="color: #000;">=</span> SF.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Allen Federn die eingestellte Steifigkeit zuweisen:</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">for</span> Feder <span style="color: #ff7700;">in</span> Abhängige_Elemente:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Feder.<span style="color: black;">k</span> <span style="color: #000;">=</span> Einstellungen.<span style="color: black;">Federsteifigkeit</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SF <span style="color: #000;">=</span> Scale<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span> from_<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> to<span style="color: #000;">=</span><span style="color: #008;">10000</span><span style="color: #000;">,</span> width<span style="color: #000;">=</span><span style="color: #008;">20</span><span style="color: #000;">,</span> orient<span style="color: #000;">=</span><span style="color: #080;">&quot;vertical&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           tickinterval<span style="color: #000;">=</span><span style="color: #008;">1000</span><span style="color: #000;">,</span> command<span style="color: #000;">=</span>SF_command<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SF.<span style="color: #808;">set</span><span style="color: black;">&#40;</span>Einstellungen.<span style="color: black;">Federsteifigkeit</span><span style="color: black;">&#41;</span> <span style="color: #800; font-style: italic;"># Anfangswert des Reglers: 100</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SF.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span>sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;nsew&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Schieberegler Kugelmasse</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Label<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span>text<span style="color: #000;">=</span><span style="color: #080;">&quot;Kugelmasse&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">2</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> SM_command<span style="color: black;">&#40;</span>event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Einstellungen.<span style="color: black;">Masse</span> <span style="color: #000;">=</span> SM.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Der Regler beginnt zwar aus gestalterischen Gründen bei null,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># dennoch ist eine Masse von null unerwünscht (Nulldivision bei</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Beschleunigung auf Warp 10).</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Die Mindestmasse wird daher immer auf 1 gesetzt.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">if</span> Einstellungen.<span style="color: black;">Masse</span> <span style="color: #000;">==</span> <span style="color: #008;">0</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Einstellungen.<span style="color: black;">Masse</span><span style="color: #000;">=</span><span style="color: #008;">1</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        SM.<span style="color: #808;">set</span><span style="color: black;">&#40;</span>Einstellungen.<span style="color: black;">Masse</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Alle Massepunkte des Systems abarbeiten:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">for</span> E <span style="color: #ff7700;">in</span> Masse_Elemente:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        E.<span style="color: black;">m</span> <span style="color: #000;">=</span> Einstellungen.<span style="color: black;">Masse</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SM <span style="color: #000;">=</span> Scale<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span> from_<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> to<span style="color: #000;">=</span><span style="color: #008;">100</span><span style="color: #000;">,</span> width<span style="color: #000;">=</span><span style="color: #008;">20</span><span style="color: #000;">,</span> orient<span style="color: #000;">=</span><span style="color: #080;">&quot;vertical&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           tickinterval<span style="color: #000;">=</span><span style="color: #008;">10</span><span style="color: #000;">,</span> command<span style="color: #000;">=</span>SM_command<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SM.<span style="color: #808;">set</span><span style="color: black;">&#40;</span>Einstellungen.<span style="color: black;">Masse</span><span style="color: black;">&#41;</span> <span style="color: #800; font-style: italic;"># Anfangswert 5</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SM.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">2</span><span style="color: #000;">,</span>sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;nsew&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Schieberegler Dämpfung</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Label<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span>text<span style="color: #000;">=</span><span style="color: #080;">&quot;Dämpfung&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">3</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> SD_command<span style="color: black;">&#40;</span>event<span style="color: #000;">=</span><span style="color: #808;">None</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Einstellungen.<span style="color: black;">D</span>ämpfung <span style="color: #000;">=</span> SD.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SD <span style="color: #000;">=</span> Scale<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span> from_<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> to<span style="color: #000;">=</span><span style="color: #008;">100</span><span style="color: #000;">,</span> width<span style="color: #000;">=</span><span style="color: #008;">20</span><span style="color: #000;">,</span> orient<span style="color: #000;">=</span><span style="color: #080;">&quot;vertical&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           tickinterval<span style="color: #000;">=</span><span style="color: #008;">10</span><span style="color: #000;">,</span> command<span style="color: #000;">=</span>SD_command<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SD.<span style="color: #808;">set</span><span style="color: black;">&#40;</span>Einstellungen.<span style="color: black;">D</span>ämpfung<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SD.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">3</span><span style="color: #000;">,</span>sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;nsew&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Checkbuttons zur Anzeigesteuerung</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CLF <span style="color: #000;">=</span> LabelFrame<span style="color: black;">&#40;</span>TE<span style="color: #000;">,</span>text<span style="color: #000;">=</span><span style="color: #080;">&quot;Anzeigen:&quot;</span><span style="color: #000;">,</span>padx<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: #000;">,</span>pady<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CLF.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span>sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;wen&quot;</span><span style="color: #000;">,</span>padx<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: #000;">,</span>pady<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Checkbutton Federkräfte</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> CF_command<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Einstellungen.<span style="color: black;">Zeige_Federkr</span>äfte <span style="color: #000;">=</span> CF_Variable.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #000;">==</span><span style="color: #080;">&quot;ja&quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CF_Variable <span style="color: #000;">=</span> StringVar<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CF_Variable.<span style="color: #808;">set</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;nein&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CF <span style="color: #000;">=</span> Checkbutton<span style="color: black;">&#40;</span>CLF<span style="color: #000;">,</span> command<span style="color: #000;">=</span>CF_command<span style="color: #000;">,</span> variable<span style="color: #000;">=</span>CF_Variable<span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            onvalue<span style="color: #000;">=</span><span style="color: #080;">&quot;ja&quot;</span><span style="color: #000;">,</span> offvalue<span style="color: #000;">=</span><span style="color: #080;">&quot;nein&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            text <span style="color: #000;">=</span> <span style="color: #080;">&quot;Federkräfte&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CF.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;w&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Checkbutton Auflagerkräfte</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> CA_command<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Einstellungen.<span style="color: black;">Zeige_Auflagerkr</span>äfte <span style="color: #000;">=</span> CA_Variable.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #000;">==</span><span style="color: #080;">&quot;ja&quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CA_Variable <span style="color: #000;">=</span> StringVar<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CA_Variable.<span style="color: #808;">set</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;nein&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CA <span style="color: #000;">=</span> Checkbutton<span style="color: black;">&#40;</span>CLF<span style="color: #000;">,</span> command<span style="color: #000;">=</span>CA_command<span style="color: #000;">,</span> variable<span style="color: #000;">=</span>CA_Variable<span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            onvalue<span style="color: #000;">=</span><span style="color: #080;">&quot;ja&quot;</span><span style="color: #000;">,</span> offvalue<span style="color: #000;">=</span><span style="color: #080;">&quot;nein&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            text <span style="color: #000;">=</span> <span style="color: #080;">&quot;Auflagerkräfte&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CA.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span> column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;w&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Checkbutton Spuraufzeichnung</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> CS_command<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Einstellungen.<span style="color: black;">Zeige_Spur</span> <span style="color: #000;">=</span> CS_Variable.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #000;">==</span><span style="color: #080;">&quot;ja&quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CS_Variable <span style="color: #000;">=</span> StringVar<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CS_Variable.<span style="color: #808;">set</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;nein&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CS <span style="color: #000;">=</span> Checkbutton<span style="color: black;">&#40;</span>CLF<span style="color: #000;">,</span>command<span style="color: #000;">=</span>CS_command<span style="color: #000;">,</span> variable<span style="color: #000;">=</span>CS_Variable<span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            onvalue<span style="color: #000;">=</span><span style="color: #080;">&quot;ja&quot;</span><span style="color: #000;">,</span> offvalue<span style="color: #000;">=</span><span style="color: #080;">&quot;nein&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            text <span style="color: #000;">=</span> <span style="color: #080;">&quot;Spurlinien&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CS.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">2</span><span style="color: #000;">,</span> column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;w&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Radiobuttons für Auswahl der Rechtsklick-Aktion</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">RLF <span style="color: #000;">=</span> LabelFrame<span style="color: black;">&#40;</span>TE<span style="color: #000;">,</span>text<span style="color: #000;">=</span><span style="color: #080;">&quot;Rechtsklick erzeugt:&quot;</span><span style="color: #000;">,</span>padx<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: #000;">,</span>pady<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">RLF.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span>sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;wen&quot;</span><span style="color: #000;">,</span>padx<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: #000;">,</span>pady<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">RR_Variable <span style="color: #000;">=</span> StringVar<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">RR_Variable.<span style="color: #808;">set</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;M&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Radiobutton<span style="color: black;">&#40;</span>RLF<span style="color: #000;">,</span>variable<span style="color: #000;">=</span>RR_Variable<span style="color: #000;">,</span>text<span style="color: #000;">=</span><span style="color: #080;">&quot;Massepunkt&quot;</span><span style="color: #000;">,</span>value<span style="color: #000;">=</span><span style="color: #080;">&quot;M&quot;</span><span style="color: #000;">,</span>underline<span style="color: #000;">=</span><span style="color: #008;">0</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: black;">&#41;</span>.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span>sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;w&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Radiobutton<span style="color: black;">&#40;</span>RLF<span style="color: #000;">,</span>variable<span style="color: #000;">=</span>RR_Variable<span style="color: #000;">,</span>text<span style="color: #000;">=</span><span style="color: #080;">&quot;Auflager&quot;</span><span style="color: #000;">,</span>value<span style="color: #000;">=</span><span style="color: #080;">&quot;L&quot;</span><span style="color: #000;">,</span>underline<span style="color: #000;">=</span><span style="color: #008;">3</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: black;">&#41;</span>.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span>sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;w&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Radiobutton<span style="color: black;">&#40;</span>RLF<span style="color: #000;">,</span>variable<span style="color: #000;">=</span>RR_Variable<span style="color: #000;">,</span>text<span style="color: #000;">=</span><span style="color: #080;">&quot;Feder&quot;</span><span style="color: #000;">,</span>value<span style="color: #000;">=</span><span style="color: #080;">&quot;F&quot;</span><span style="color: #000;">,</span>underline<span style="color: #000;">=</span><span style="color: #008;">0</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: black;">&#41;</span>.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">2</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span>sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;w&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Buttons für Schnelleinstellungen</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Button &quot;Antigravity&quot; (https://xkcd.com/353/)</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> BG_command<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;&quot;&quot;Schaltet Schwerelosigkeit ein&quot;&quot;&quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    SG.<span style="color: #808;">set</span><span style="color: black;">&#40;</span><span style="color: #008;">0</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Button<span style="color: black;">&#40;</span>TE<span style="color: #000;">,</span>text<span style="color: #000;">=</span><span style="color: #080;">&quot;Antigravity&quot;</span><span style="color: #000;">,</span>command<span style="color: #000;">=</span>BG_command</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       <span style="color: black;">&#41;</span>.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">2</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span>sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;we&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Button &quot;Entspannen&quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> BE_command<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;&quot;&quot;Setzt Federkräfte auf null.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">    Die aktuelle Federlänge l wird zur entspannten Länge l0.&quot;&quot;&quot;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">for</span> Feder <span style="color: #ff7700;">in</span> Abhängige_Elemente:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Feder.<span style="color: black;">reset</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Button<span style="color: black;">&#40;</span>TE<span style="color: #000;">,</span>text<span style="color: #000;">=</span><span style="color: #080;">&quot;Entspannen&quot;</span><span style="color: #000;">,</span>command<span style="color: #000;">=</span>BE_command</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       <span style="color: black;">&#41;</span>.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">2</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span>sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;we&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Infozeile wird sekündlich aktualisiert</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> Infozeilenupdate<span style="color: black;">&#40;</span>event<span style="color: #000;">=</span><span style="color: #808;">None</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    A <span style="color: #000;">=</span> <span style="color: #808;">len</span><span style="color: black;">&#40;</span>Lager_Elemente<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    M <span style="color: #000;">=</span> <span style="color: #808;">len</span><span style="color: black;">&#40;</span>Masse_Elemente<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    F <span style="color: #000;">=</span> <span style="color: #808;">len</span><span style="color: black;">&#40;</span>Abhängige_Elemente<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Infozeile.<span style="color: black;">config</span><span style="color: black;">&#40;</span>text<span style="color: #000;">=</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #080;">&quot;%i Auflager, %i Massepunkt%s, %i Feder%s, %i Physikschritte/s&quot;</span>%<span style="color: black;">&#40;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        A<span style="color: #000;">,</span>M<span style="color: #000;">,</span><span style="color: #080;">&quot;&quot;</span> <span style="color: #ff7700;">if</span> M<span style="color: #000;">==</span><span style="color: #008;">1</span> <span style="color: #ff7700;">else</span> <span style="color: #080;">&quot;e&quot;</span><span style="color: #000;">,</span>F<span style="color: #000;">,</span><span style="color: #080;">&quot;&quot;</span> <span style="color: #ff7700;">if</span> F<span style="color: #000;">==</span><span style="color: #008;">1</span> <span style="color: #ff7700;">else</span> <span style="color: #080;">&quot;n&quot;</span><span style="color: #000;">,</span>Einstellungen.<span style="color: black;">PPS</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    TE.<span style="color: black;">after</span><span style="color: black;">&#40;</span><span style="color: #008;">1000</span><span style="color: #000;">,</span>Infozeilenupdate<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Infozeile <span style="color: #000;">=</span> Label<span style="color: black;">&#40;</span>TE<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Infozeile.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">3</span><span style="color: #000;">,</span>column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span>columnspan<span style="color: #000;">=</span><span style="color: #008;">2</span><span style="color: #000;">,</span>sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;w&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Infozeilenupdate<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Go!</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">T.<span style="color: black;">mainloop</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li></ol></pre>]]></content:encoded>
<link>https://bauforum.wirklichewelt.de/index.php?id=11455</link>
<guid>https://bauforum.wirklichewelt.de/index.php?id=11455</guid>
<pubDate>Thu, 22 Dec 2016 11:27:27 +0000</pubDate>
<category>Software</category><dc:creator>Martin Vogel</dc:creator>
</item>
<item>
<title>Simulation chaotischer Masse-Feder-Systeme mit Python 3</title>
<content:encoded><![CDATA[<p>Während man bei einfachen Faden- oder Federpendeln gut berechnen kann, welchen Zustand sie zu jedem beliebigen Zeitpunkt haben werden (sonst gäbe es keine mechanischen Uhren), neigt die Kombination von mehreren Pendeln zu einem hochgradig chaotischen Verhalten.</p>
<p>Ein kleines Python-3-Programm, dass unten heruntergeladen werden kann, erlaubt die Konstruktion komplexer Masse-Feder-Systeme, bei denen sich zahlreiche Parameter über Schieberegler beeinflussen lassen.</p>
<p><img src="https://bauforum.wirklichewelt.de/images/uploaded/Bild_OX9OI0LA1.png" alt="[image]"  /></p>
<p>Mathematisch steckt kaum etwas dahinter. Auf einen Massepunkt wirken Kräfte, diese bewirken pro Berechnungsschritt eine Beschleunigung, jene verändert die Geschwindigkeit des Massepunkts, wodurch dieser letztlich nach jedem Rechenschritt eine neue Position erhält. Da an den Massepunkten Federn hängen, sorgt die Positionsänderung für eine Dehnung oder Stauchung ihrer Endpunkte, wodurch wieder Kräfte entstehen, die im nächsten Durchlauf wieder auf die Massepunkte wirken und so fort.</p>
<p>Durch diese einfachen Rechnungen entstehen hochkomplexe Bewegungen, welche vom Programm aufgezeichnet werden können.</p>
<p>Wer sich schon immer einmal mit Python 3 beschäftigen wollte, ist herzlich eingeladen, mit dem Programm herumzuspielen und es für seine Zwecke anzupassen.</p>
<p><strong>Kurzanleitung:</strong></p>
<p>Das physikalische Modell besteht aus blauen Lagerpunkten, roten Massepunkten und grauen Stabfedern.<br />
Die Lagerpunkte und die Massepunkte können mit der Maus verschoben werden.<br />
Die Federn folgen dieser Bewegung.</p>
<p>Neue Massepunkte und Lagerpunkte lassen sich mit den Tasten „M“ und „L“ sowie mit der rechten Maustaste erzeugen. <br />
Massepunkte werden mittels einer Feder mit dem nächstliegenden verschieblichen Punkt verbunden, wenn die Gravitation ungleich null ist. Zum schnellen Einschalten der Schwerelosigkeit dient der Button „Antigravity“.</p>
<p>Neue Federn werden durch zweimaliges Drücken der rechten Maustaste oder der Taste „F“ jeweils am Start- und am Zielobjekt angebunden. Unerwünschte Druck- oder Zugspannungen in den Federn, die während des Konstruierens entstehen können, lassen sich mit dem Button „Entspannen“ auf null setzen.</p>
<p>Bei hohen Federsteifigkeiten und geringen Kugelmassen neigt das Modell dazu, in dramatischer Weise aufzuschwingen. Der Dämpfungsregler sollte daher niemals auf einem zu kleinen Wert stehen.</p>
<p>Das Löschen von Objekten ist noch nicht implementiert. Auch das Laden und Speichern von Modellen und Reglerstellungen wird der geneigten Leserin und dem geneigten Leser des Python-3-Quelltextes dieses Programms überlassen. </p>
<p>Viel Spaß damit!<img src="http://vg05.met.vgwort.de/na/724e7f076abc4f58b8790236523d999e" alt="[image]"  /></p>
<p><strong>Download: <a href="images/uploaded/ZIP-Archiv_XQGMILX91.zip" target="_blank"><img src="img/zip.png" alt="[image]"  />ZIP-Archiv_XQGMILX91.zip</a></strong></p>
]]></content:encoded>
<link>https://bauforum.wirklichewelt.de/index.php?id=11343</link>
<guid>https://bauforum.wirklichewelt.de/index.php?id=11343</guid>
<pubDate>Tue, 02 Feb 2016 12:23:19 +0000</pubDate>
<category>Software</category><dc:creator>Martin Vogel</dc:creator>
</item>
</channel>
</rss>
