From 853da5c405563ed445d4330223fd882dca053ae2 Mon Sep 17 00:00:00 2001 From: "A.M. Rowsell" Date: Sun, 19 Sep 2021 15:53:11 -0400 Subject: [PATCH 1/5] Wrapped entry box changed callback in try/except to handle ValueError --- spirographs.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/spirographs.py b/spirographs.py index f503fa0..21fd4a1 100644 --- a/spirographs.py +++ b/spirographs.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +# Copyright 2021 Alexander Rowsell. Licenced under MPLv2.0 # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -69,7 +70,11 @@ class spirographs: self.updatePlot() def bigRadiusEntry_changed_cb(self, widget): - self.bigRadius = float(widget.get_text()) + try: + self.bigRadius = float(widget.get_text()) + except ValueError: + print("Couldn't get a float for R, ignoring...\n") + return self.bigRadiusAdjustment.set_value(self.bigRadius) def smallRadiusAdjustment_value_changed_cb(self, widget): @@ -79,7 +84,11 @@ class spirographs: self.updatePlot() def smallRadiusEntry_changed_cb(self, widget): - self.smallRadius = float(widget.get_text()) + try: + self.smallRadius = float(widget.get_text()) + except ValueError: + print("Couldn't get a float for r, ignoring...\n") + return self.smallRadiusAdjustment.set_value(self.smallRadius) def distanceAdjustment_value_changed_cb(self, widget): @@ -89,7 +98,11 @@ class spirographs: self.updatePlot() def distanceEntry_changed_cb(self, widget): - self.distance = float(widget.get_text()) + try: + self.distance = float(widget.get_text()) + except ValueError: + print("Couldn't get a float for d, ignoring...\n") + return self.distanceAdjustment.set_value(self.distance) def recalcPoints(self): From 404110665dc822140786edb9880880b0e73a892f Mon Sep 17 00:00:00 2001 From: "A.M. Rowsell" Date: Tue, 27 Sep 2022 15:36:16 -0400 Subject: [PATCH 2/5] Updated readme with fixed image --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 35ddb59..a643633 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ Spirographs! -![Screenshot of v1](https://frozendev.tk/~amr/images/spirographs_v1.png) +![Screenshot of software](https://frozendev.tk/~amr/images/spirographspy.png) Everyone who grew up playing with this toy remembers it fondly. Very cool shapes and patterns. Recently, I was wondering if there was a mathematical formula describing the shapes created by Spriographs, and of course there is! -They're actually quite simple. The shapes are called [hypotrochoids](https://en.wikipedia.org/wiki/Hypotrochoid) and [epitrochoids](https://en.wikipedia.org/wiki/Epitrochoid). To calculate each point, you simple use the following parametrized equations, plugging in 0 to 2π for θ: +They're actually quite simple. The shapes are called [hypotrochoids](https://en.wikipedia.org/wiki/Hypotrochoid) and [epitrochoids](https://en.wikipedia.org/wiki/Epitrochoid). To calculate each point, you simple use the following parametrized equations, plugging in 0 to 2π for θ: -![](https://frozendev.tk/~amr/images/hypotrochoid.png) +![](https://frozendev.tk/~amr/images/hypotrochoid.png) ![](https://frozendev.tk/~amr/images/epitrochoid.png) From 84cd8dc0ca6f7761ae45c4868f001b18603b2ae5 Mon Sep 17 00:00:00 2001 From: "A.M. Rowsell" Date: Tue, 19 Nov 2024 05:24:34 -0500 Subject: [PATCH 3/5] Updated license info, added SPDX identifier --- LICENSE | 8 +------- spirographs.py | 1 + 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/LICENSE b/LICENSE index a612ad9..6c9ddc6 100644 --- a/LICENSE +++ b/LICENSE @@ -364,10 +364,4 @@ file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. +You may add additional accurate notices of copyright ownership. \ No newline at end of file diff --git a/spirographs.py b/spirographs.py index 21fd4a1..71f3652 100644 --- a/spirographs.py +++ b/spirographs.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 # -*- coding: utf-8 -*- # Copyright 2021 Alexander Rowsell. Licenced under MPLv2.0 From 2ddcd98636043855381baeeef60e26396f12cee7 Mon Sep 17 00:00:00 2001 From: "A.M. Rowsell" Date: Tue, 19 Nov 2024 05:25:00 -0500 Subject: [PATCH 4/5] Changed wording for error message --- spirographs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spirographs.py b/spirographs.py index 71f3652..44d76a9 100644 --- a/spirographs.py +++ b/spirographs.py @@ -74,7 +74,7 @@ class spirographs: try: self.bigRadius = float(widget.get_text()) except ValueError: - print("Couldn't get a float for R, ignoring...\n") + print("Not a float for R, ignoring...\n") return self.bigRadiusAdjustment.set_value(self.bigRadius) From 1e4059390ab9c6e09b85ffad0d5ec9ff110fc228 Mon Sep 17 00:00:00 2001 From: "A.M. Rowsell" Date: Tue, 19 Nov 2024 06:04:54 -0500 Subject: [PATCH 5/5] Fixed README image links... --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a643633..5de4868 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ Spirographs! -![Screenshot of software](https://frozendev.tk/~amr/images/spirographspy.png) +![Screenshot of software](https://frzn.dev/~amr/images/spirographspy.png) Everyone who grew up playing with this toy remembers it fondly. Very cool shapes and patterns. Recently, I was wondering if there was a mathematical formula describing the shapes created by Spriographs, and of course there is! They're actually quite simple. The shapes are called [hypotrochoids](https://en.wikipedia.org/wiki/Hypotrochoid) and [epitrochoids](https://en.wikipedia.org/wiki/Epitrochoid). To calculate each point, you simple use the following parametrized equations, plugging in 0 to 2π for θ: -![](https://frozendev.tk/~amr/images/hypotrochoid.png) +![](https://frzn.dev/~amr/images/hypotrochoid.png) -![](https://frozendev.tk/~amr/images/epitrochoid.png) +![](https://frzn.dev/~amr/images/epitrochoid.png) And that's it! To play around with the different patterns, this Python GTK3 app was created so you could use sliders to change the parameters and see how they affect the output. \ No newline at end of file