Could someone show me an example of how to put a panda3d window in a tkinter paned window. I did this with pyopengl and tkinter.
Don’t forget to have a forum search.
That is not what a paned window is. https://www.tutorialspoint.com/python/tk_panedwindow.htm
if you have 1 on the right and one on the left and move the right one to the left, the right one will get bigger and left one will get smaller.
like this:
I think i know how to put it into a panned window but first i have to get it to work in a class.
This is what i have but it wont open a window.
from direct.showbase.ShowBase import ShowBase
from panda3d.core import WindowProperties
import tkinter
class panda():
def initgl(self):
# 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()
app = panda()
Everything works in the classroom.
from direct.showbase.ShowBase import ShowBase
from panda3d.core import WindowProperties
class Tkinter_window(ShowBase):
def __init__(self):
ShowBase.__init__(self, windowType='none')
base.startTk()
frame = base.tkRoot
frame.update()
props = WindowProperties()
props.setParentWindow(frame.winfo_id())
props.setOrigin(0, 0)
props.setSize(frame.winfo_width(), frame.winfo_height())
base.makeDefaultPipe()
base.openDefaultWindow(props=props)
scene = base.loader.loadModel("environment")
scene.reparentTo(render)
tkinter_window = Tkinter_window()
tkinter_window.run()
i tried this:
self.app = Tkinter_window(m1)
but it wont let me append it to a paned window.
TypeError: __init__() takes 1 positional argument but 2 were given