Display in a particular tkinter window? #142
Unanswered
ACE0PERFECT
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have wrote a application with GUI by tkinter. It is about optics design, and I want to use Ursina to display visualized 3D simulation in this application. So I have a Frame (or PanedWindow or Canvas, whatever) for Ursina to display. That is to say, I want Ursina display in a particular already existed tkinter component (like Frame or PanedWindow), not to initialize a new one.
I know Ursina is based on Panda3D, and I have achieved what I need by Panda3D, so I think it is possible for Ursina, but I haven't figured it out.
Here is my progress:
1 This example illustrate the need of me:
`
from direct.showbase.ShowBase import ShowBase
from panda3d.core import WindowProperties
import tkinter
root = tkinter.Tk()
root.geometry('1920x1080')
frame_panda3d = tkinter.Frame(root)
frame_panda3d.place(x=0, y=0, height=1920, width=1080)
root.update()
class Tkinter_window(ShowBase):
def init(self):
ShowBase.init(self, windowType='none')
tkinter_window = Tkinter_window()

tkinter_window.run()
`
This is the output:
2 I tried to transplant the above code to Ursina. But I found black margins. props.setOrigin(0, 0) doesn't work for this. I guess this is because the involvement of ursina.window(), but I am not sure. Code of this picture is a sample of Ursina. I modified it (to be exactly, ShowBase) a bit with codes in part 1.

Here is my question:
Is there a way to make Ursina display in a specific tkinter component? Or how to deal with these black margins. Thankyou
Beta Was this translation helpful? Give feedback.
All reactions