'NSWindow drag regions should only be invalidated on the Main Thread

I am writing a python file that runs another python file. This file normally displays a tool made in Tkinter. However, it keeps giving me this error:

2022-04-23 09:16:13.748 Python[1881:28993] WARNING: NSWindow drag regions should only be invalidated on the Main Thread! This will throw an exception in the future. Called from (
        0   AppKit                              0x00007fff2e3497f0 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 371
        1   AppKit                              0x00007fff2e346ce1 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1416
        2   AppKit                              0x00007fff2e3f2fa4 -[NSPanel _initContent:styleMask:backing:defer:contentView:] + 50
        3   AppKit                              0x00007fff2e346753 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
        4   AppKit                              0x00007fff2e3f2f59 -[NSPanel initWithContentRect:styleMask:backing:defer:] + 64
        5   AppKit                              0x00007fff2ecdc61e -[NSSavePanel initWithContentRect:styleMask:backing:defer:] + 97
        6   AppKit                              0x00007fff2ece4828 -[NSOpenPanel initWithContentRect:styleMask:backing:defer:] + 151
        7   AppKit                              0x00007fff2e5df19a -[NSPanel init] + 75
        8   AppKit                              0x00007fff2ecdc5b6 -[NSSavePanel init] + 80
        9   AppKit                              0x00007fff2e9cdef5 +[NSSavePanel(Instantiation) _crunchyRawUnbonedPanel] + 81
        10  libtk8.6.dylib                      0x0000000154cd3a11 Tk_GetOpenFileObjCmd + 67
        11  libtcl8.6.dylib                     0x0000000154ac46dc TclNRRunCallbacks + 80
        12  _tkinter.cpython-38-darwin.so       0x0000000154a9d049 Tkapp_Call + 585
        13  Python                              0x000000010bb94112 cfunction_call_varargs + 290
        ............
        97  Python                              0x000000010bb93dfd PyVectorcall_Call + 109
        98  Python                              0x000000010bd025ba t_bootstrap + 74
        99  Python                              0x000000010bcb5589 pythread_wrapper + 25
        100 libsystem_pthread.dylib             0x00007fff685bed76 _pthread_start + 125
        101 libsystem_pthread.dylib             0x00007fff685bb5d7 thread_start + 15
)

When I run this file on its own, everything works perfectly fine. Both use the same python versions.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source