[Tkinter-discuss] winfo_id on OS/X
Jeff Hultquist
jhultquist at me.com
Tue Dec 22 12:04:26 EST 2015
I am trying to use tkinter with the Panda3D (panda3d.org <http://panda3d.org/>) graphics library. I want to position a graphics window into a tkinter frame.
Attached below is some sample code that uses the frame.winfo_id() as the argument to Panda3D’s setParentWindow method.
This works on Linux and Windows, but seg-faults on OS/X. It appears the winfo_id is not valid on OS/X.
How can we get a proper handle for the parenting of the 3d view into a tkinter frame?
FWIW, there is a thread is ongoing on the Panda3D forum, but the answer seems to lie deep inside tkinter.
https://www.panda3d.org/forums/viewtopic.php?f=4&t=18449 <https://www.panda3d.org/forums/viewtopic.php?f=4&t=18449>
Many thanks.
----------------------------------
from direct.showbase.ShowBase import ShowBase
from panda3d.core import WindowProperties
import Tkinter
base = ShowBase(windowType='none')
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) # —— on OS/X, we segfault here
scene = base.loader.loadModel("environment")
scene.reparentTo(base.render)
base.run()
----------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20151222/8cbe3d12/attachment.html>
More information about the Tkinter-discuss
mailing list