Multi-Window design

I’m trying to make an application that may have an arbitrary number of windows ( 0 or more on mac optimally, and probably 1 or more for other OSs). The windows will all be the same, and for the most part independent. I’m basically making a file editor that can work on multiple files at once.

I’m looking for the best approach for doing this.

I can work with a single ShowBase instance, and make window’s with it’s openWindow (or roll my own equivalent on my ShowBase subclass). ShowBase seems to have a special relation with its MainWindow though (things like render2D and such just get setup on it I think).

Another approach, and I’m not sure if it could work at all would to be to make a ShowBase for each of my windows.

Or I can ditch those 2500+ lines of python and avoid ShowBase completely. It does some nice things I like though (like render2D and pixel2D, mouse and keyboard support etc.).

Generally, whats the proper approach for making multiple panda3d main windows?

Dealing with all the frame rendering for the windows is not much of an issue for me. I’ll be doing that manually and usually all windows will be inactive (Its an editor and nothing is animating, so no point of rendering lots of identical frames)

-Thanks

You should only create one ShowBase. Multiple ShowBase’s are asking for trouble in lots of subtle and dangerous ways.

I would use base.openWindow() for each window. It’s true that this won’t automatically create a render2d for each new window, but you can do that on your own, and for less work than setting up a brand new ShowBase. (There are a few examples of doing exactly this in other posts in the forum.)

David

Ok, thanks.

So I guess I’ll dispose of showBase’s main window somehow, the copy the code (I hate doing that) for setting up stuff like render2D, fps displays, and stick them in my openWindow wrapper.