_tkinter.TclError: bad window path name".!dateentry.!entry"

84 Views Asked by At

An error was reported during program execution, so I used two files for testing. When calling test in the test1 file, the DateEntry widget will disappear and an error will appear when clicked. I checked a lot, changed the style theme, updated the window, or created There is no "_" in the window name, but the error still occurs. The multi-select buttons and drop-down components in ttkbootstrap were also used in the original code, and they all functioned normally.The same problem occurs if I replace ttkbootstrap.dataentry with tkcalende.dataentry and I don't know where I went wrong.

enter image description here the error

Exception in Tkinter callback
Traceback (most recent call last):
  File "G:\python\lib\tkinter\__init__.py", line 1883, in __call__
    return self.func(*args)
  File "G:\python\lib\site-packages\ttkbootstrap\widgets.py", line 242, in _on_date_ask
    new_date = Querybox.get_date(
  File "G:\python\lib\site-packages\ttkbootstrap\dialogs\dialogs.py", line 1671, in get_date
    chooser = DatePickerDialog(
  File "G:\python\lib\site-packages\ttkbootstrap\dialogs\dialogs.py", line 601, in __init__
    self.root = ttk.Toplevel(
  File "G:\python\lib\site-packages\ttkbootstrap\window.py", line 454, in __init__
    self.transient(transient)
  File "G:\python\lib\tkinter\__init__.py", line 2224, in wm_transient
    return self.tk.call('wm', 'transient', self._w, master)
_tkinter.TclError: bad window path name ".!dateentry.!entry"


test1.py

import ttkbootstrap as ttk
class Test1:
    def __init__(self):
        self.win1 = ttk.Window()
        self.win1.geometry("600x600")
        self.btn = ttk.Button(self.win1, text="click", command=self.test)
        self.btn.grid(row=0, column=0)
        self.win1.mainloop()
    def test(self):
        import test
        test.Test()
Test1()

this is test.py

import ttkbootstrap as ttk
class Test:
    def __init__(self):
        self.win = ttk.Window()
        self.win.geometry("300x300")
        self.test = ttk.DateEntry(self.win,bootstyle="success")
        self.test.update()
        self.test.grid(row=0, column=0)
        self.win.mainloop()

I want the dataentry widget to run normally after calling.

0

There are 0 best solutions below