How to open a new window

I’m creating a GUI by panda3D now, one necessary thing is that I need to create a new open window for user interaction. The window may be pop up when a particular button is clicked. But I don’t know if I can create multiple windows in one program using panda3D, but it is important for me to improve my GUI.

Please help,
Thank you in advance

Well, you know how you are calling framework.open_window() to open the first window? Just call it another time to open the second window.

You can pass in a WindowsProperties object indicating the size and origin of the window, if desired.

thank you rdb,
I’m using python now, your advice is really helpful.
I find your relative response in another topic, follow it I write such codes

render2 = NodePath(“render2”)
win2 = base.openWindow(size = (400,400),scene=render2)
c = DirectButton(text=(“OK”), scale=.5, command=createwindow)

however, the window is created but I can’t find the directbutton, which is expected to be seen. I think I make some mistakes, please help me

Thanks again

ok I find the problem is that I didn’t set a camera

wp = WindowProperties()
wp.setSize(700, 500)
win2 = base.openWindow(props=wp, aspectRatio=1.33)
render2d = NodePath(‘render2d’)
camera2d = base.makeCamera2d(win2)
c = DirectButton(text=(“OK”), scale=0.05, command=createwindow)

now it works well

I have some problems in using open_window() now (actually I used python in the past days, so I just try C++ to open a new window today), and I need help now.
I used the following codes:

    WindowFramework *window2 = framework.open_window();
	WindowProperties window_props2 = window2->get_graphics_window()->get_properties();
	window_props2.set_size(800, 600);
	window_props2.set_origin(20, 50);

the problem is that the newly created window is always fullscreen, seems that the set_size code do not work at all. I checked the prc.file and ensure that I didn’t set the fullscreen true.
Actually, the original window is not fullscreen, as expected.

So, what’s wrong is it? Please help me
Thanks in advance

Oh, the reason is that I use load_prc_file_data("", “fullscreen true”) in my main.cpp and I forgot it…

Please note that request_properties takes just a set of properties you wish to change, so this should have been enough:

    WindowFramework *window2 = framework.open_window();
	WindowProperties window_props2;
	window_props2.set_size(800, 600);
	window_props2.set_origin(20, 50);
1 Like