So I am trying to design a program that can open and close panda3d windows on the fly, where each window has its own properties and rendernode. This is my current solution:
base = ShowBase()
base.closeWindow(base.win)
class my_exp():
#first window gets cam 0, because base window is closed
camCounter = -1
def __init__(self, windowname, x=None, y=None):
#create window and render node for the experiment
self.mwindow = base.openWindow()
self.mRender = NodePath('mRender')
#set window name, size if given
self.mwp = WindowProperties()
self.mwp.setTitle(windowname)
if (x and y):
self.mwp.setSize(x, y)
self.mwindow.requestProperties(self.mwp)
#make camera accessible
my_exp.camCounter += 1
self.camNumber = my_exp.camCounter
base.camList[self.camNumber].reparentTo(self.mRender)
def addActor(self, actorPath, x, y, z, scale):
tempActor = Actor.Actor(actorPath)
tempActor.setPos(x, y, z)
tempActor.setScale(scale, scale, scale)
tempActor.reparentTo(self.mRender)
#this function definitely isn't right...
def expClose(self):
base.graphicsengine.removeWindow(base.mwindow)
x = my_exp("experiment x")
x.addActor("models/panda-model", 0, 0, 0, 0.003)
y = my_exp("experiment y", 100, 100)
y.addActor("models/panda-model", 0.01, 0.01, 0.01, 0.001)
base.run()
However, calling base.run() here just creates both windows. How could I, for example, create window x, wait 5 seconds, close window x and create window y? I feel like I’m using Showbase wrong, and maybe I shouldn’t even be using it??