I am writing a tkinter application that contains a Panda3D window. However, I have found that when I click on or interact with the Panda3D window, I am then unable to click on any tkinter Entry widget. If I select out of the tk window and then select it again, The Entry widgets work again. Why is this happening?
Code to reproduce:
from direct.showbase.ShowBase import ShowBase
from panda3d.core import WindowProperties
import tkinter as tk
from tkinter import Button, Entry
from multiprocessing import Process
class AppTk(ShowBase):
def __init__(self):
ShowBase.__init__(self, windowType='none')
self.startTk()
self.tk = self.tkRoot
self.tk.geometry("500x400")
self.label_frame = tk.LabelFrame(self.tk, text='Panda3D Example', width=420, height=340)
self.label_frame.pack()
self.button = Button(self.tk, text='Click me !', bd='5')
self.button.pack()
self.entry = Entry(self.tk)
self.entry.pack()
# Set properties of the Panda3D window
props = WindowProperties()
props.set_parent_window(self.label_frame.winfo_id()) # Display within the label frame
props.set_origin(10, 20) # Relative to the label frame
props.set_size(400, 300)
self.make_default_pipe()
self.open_default_window(props=props)
scene = self.loader.load_model("environment")
scene.reparent_to(self.render)
app = AppTk()
app.run()