Multiple Windows

Hello, firstly I would like to say this looks like a nicely layed out engine :slight_smile:

Is there a way to create multiple windows? I have had a look through the manual but could not find anything. I was pondering on the idea of having a seperate window to output stuff to using the directGUI stuff.

If not, I suppose I will have to look at TKinter just like the sceneEditor uses?

Im extremely new to python (not even typed 1 line yet!) so expect to see some odd questions in the future :slight_smile:

Thanks in advance

This section of the manual is being written even now.

The short answer is, use:


win = base.openWindow()

to open a new window with default parameters. If you want to specify the precise location and/or size of the window, use something like:

wp = WindowProperties()
wp.setSize(100, 100)
wp.setOrigin(512, 128)
win = base.openWindow(props = wp, aspectRatio = 1)

Both of the above will set up the window with a camera that renders the default scene, render, by default. If you want it to render some other scene instead you have to create a NodePath to represent that scene, and move the recently-created camera over to that scene:

myRender = NodePath('myRender')
base.camList[-1].reparentTo(myRender)

Note that base.camList[-1] is the Python convention to return the last element of the list base.camList. This will be the camera created by the most recent call to base.openWindow.

If you want to put DirectGUI objects in your new window, you will need to create a render2d for this window. You can do this with:

myRender2d = NodePath('myRender2d')
myCamera2d = base.makeCamera2d(win)
myCamera2d.reparentTo(myRender2d)

Then you will pass myRender2d as the parent parameter to each DirectGUI object you create.

David

Thanks for the reply. Multiple windows are easier than I was expecting :slight_smile:

Managed to get a couple showing which is quite nice, now to play about a little more so I can understand bit of python although I have 1 issue but thats better put in the installation forum.

Thanks again.

Oops! Thought I was logged in.