Tkinter PyEval_RestoreThread: NULL tstate Error

Hi, I’m having problems with Tkinter in Panda3D. After the Code I’m explaining the issue.

from panda3d.core import *
from direct.showbase.ShowBase import ShowBase
from Tkinter import *
import sys, os
from engine import panSave

class Engine(ShowBase):
    def __init__(self):

    def setUp_UI(self):

        menu = Menu(self.tkRoot)
        file_menu = Menu(menu)
        menu.add_cascade(label="File", menu=file_menu)

engine = Engine()

Note: the function does only print “Hello” so far. I’ve also tried it with a simple function, that also prints “Hello” and is in the same Class, so the function shouldnt be the problem.

Is this Code I’m getting this Error after klicking on the “Save” submenu:

Fatal Python error: PyEval_RestoreThread: NULL tstate

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
AL lib: (EE) alc_cleanup: 1 device not closed

Process finished with exit code 3

How can I solve this problem?

Which version of Panda are you using, and does it help if you put “want-tk true” in Config.prc?

I’m using Panda3d 1.9.4. I also put “want-tk true” in my config file and used self.spawnTk(). But it makes no difference if I’m using the tkinter included in Panda3D or the Python Tkinter Module.

I would suggest that you try the latest (1.10) version of Panda3D, available via the “devel” section on the download page or via pip. I’m curious whether the issue also exists in the latest version.

If you think you’ve found a bug in Panda3D, please post a bug on the GitHub issue tracker containing a small reproducible test case that can be run without requiring additional files.