So I am working on an application which uses panda3d. Its not a game. I need a way to dock/undock windows with the mouse. Ie. Grab a window’s edge, have it pop out, drag it to another screen position and drop/lock it in place. I haven’t found a way to do this yet I am new to this engine. I am a graduating CS student so none of this is beyond me I just haven’t found anything in the documentation for it.
This is actually controlled by the operating system. Can you give an example of such an app?
Unity3d… You mean I couldn’t have one main window/pane where all my other windows are docked to? Is there no way to do that in panda3d?
Or is there some way to render a gui without drawing over a 3d rendering?
In fact, panels and Windows are different concepts. Panda lets you create multiple Windows. Panels must be implemented at the GUI library level, or independently. By the way, unity is not an application, it is a development environment and most likely it is implemented on the WinAPI.
I think–if I understand correctly–that an example of the sort of app that they’re trying to make would be GIMP. By default, it has a window in which image-editing is done, and a separate window that holds the various editing tools and their options, and which can be placed separately from the other window.
As to the question, hmm…
Based on a quick search, it looks like PyQt might be able to do this, and I believe that PyQt can be made to interoperate with Panda.
Otherwise, as suggested above, perhaps you could use various mouse-events to implement GUI-dragging, and furthermore to detect an attempt to drag a GUI-element out of a window. When this happens, you could spawn a new window, containing the GUI element, and then update the position of that window programmatically until the dragging mouse-button is released. Or something like that.
That said, there may be a much better way of doing this–it’s not something that I’ve significantly looked into, myself, and so I’m perhaps not familiar with whatever features or tools might be available!
I think I’ve found a solution, based on a hunch I had when the first reply said it was something the OS handled. I think I can use the X11 window manager to contain the 3d window and my GUI. Perhaps by forking and multi-threading.
Ok so X11 is a bit too low level for this.
So I plan on using Python-tkinter.
Again I am new to this so I am asking another question. How might I effectively lock said Panda3d window to a background canvas like tkinter? I think there’s two ways: 1. have the user grab a certain part of the panda3d window, while tkinter runs in the background. Once it has been locked to its position relative to the main canvas it should just be locked there. That seems kinda like a bad practice.
The other option is fully integrating the panda3d window into the tkinter main canvas. I am not sure how to go about this. Can anyone provide some guidance here?
This is an example I found it on the forum.
from direct.showbase.ShowBase import ShowBase from panda3d.core import WindowProperties import tkinter # Start ShowBase, but don't open a Panda window yet base = ShowBase(windowType='none') # Start Tkinter integration, get the root window handle base.startTk() frame = base.tkRoot frame.update() id = frame.winfo_id() width = frame.winfo_width() height = frame.winfo_height() props = WindowProperties() props.setParentWindow(id) props.setOrigin(0, 0) props.setSize(width, height) base.makeDefaultPipe() base.openDefaultWindow(props=props) scene = base.loader.loadModel("environment") scene.reparentTo(base.render) base.run()