Hello,
sorry about respoding so late I got busy and also wanted to wait until I had some working code(which I kinda still don’t have). So taking what you said (i think) and some of the code from the posts you gave I ended up with the following.
Code to run OtherWindow class
from OtherWindow import *
ellipse(0,0,20,20)
sw = OtherWindow()
sw.test([100,200])
OtherWindow class
class OtherWindow(PApplet):
def __init__(self):
switches = ('--sketch-path=' + sketchPath(), '')
PApplet.runSketch(switches, self)
def settings(self):
self.size(300,200)
def setup(self):
print("HERE")
def test(self,a):
print(a)
self.ellipse(a[0],a[0],30,30)
self.ellipse(a[1],a[1],30,30)
The above code opens the second window with the ellipses in the positions given by a. This is good but when I try to change the code or add certain things I start to get problems.
If I want to set the background to a certain color. Adding self.background(0) to setup() or test() gives me a null pointer exception but the background does change to black.
If I move the size() function from settings() into setup(). the test() function gets called correctly and the size of the 2nd window does not get changed.
Getting rid of setup() causes the test() function to not work but no errors. This is why I have the random print(“HERE”) code added.
The last problem that happens might not be an error but it is weird. After I exit out of the 2nd window if I try to run the code again the processing IDE will freeze for a little then when it unfreezes I have to click run again to actually run the code. This has happened each time I closed the 2nd window, but I can avoid it by only closing the 1st window which leaves the 2nd window up. This allows me to run the code on the first try but will cause multiple “2nd windows” to stay on screen since they never go away, unless I close one which closes them all.
All of these problems are really confusing me and I have no clue how to fix them. I’m sure they are happening due to my lack of understanding of the code I am using, but i’m not the best coder so a lot of this stuff goes over my head. If I could get some help with this it would be greatly appreciated.
Thanks.