From ff11c1ce84cec8051b0673dd3d83c3cc5c528e2a Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Wed, 21 Feb 2024 16:49:48 -0500 Subject: [PATCH] Set color of next particle --- src/painter.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/painter.py b/src/painter.py index 71fffa4..e116bd4 100644 --- a/src/painter.py +++ b/src/painter.py @@ -38,6 +38,9 @@ class Painter(Widget): # shape of particle to add next self.shape=Cross + # color of particle to add next + self.color=(0,0,1) + # underlying lattice self.lattice=None @@ -232,7 +235,7 @@ class Painter(Widget): # create new particle if touch.button=="right": - new=self.shape(touchx,touchy) + new=self.shape(touchx,touchy,color=self.color) # snap to lattice if self.lattice!=None: new.move(self.lattice.nearest_delta(new.elements[0].pos)) @@ -440,6 +443,9 @@ class Painter(Widget): # set color of selected particles def set_color(self,color): + # set color for next particles + self.color=color + # set color of selected particles for particle in self.selected: particle.color=color # redraw