pythonpython-3.xmultithreadingmacosnswindow

NSWindow drag regions should only be invalidated on the Main Thread! This will throw an exception in the future


I am writing a Python program with two threads. One displays a GUI and the other gets input from a scanner and saves data in an online database. The code works fine on my raspberry pi but if I try it on my MacBook Pro (Catalina 10.15.2), I get the above mentioned warning followed by my code crashing.

Does anyone have an idea how to get it working or what causes the problem?


Solution

  • You likely use different Python versions. Your Python on your Raspberry PI still allows invalidating NSWindow drag regions outside the Main thread, while your Python in your MacBook Pro already stopped supporting this. You will likely need to refactor your code so that NSWindow drag regions will only be invalidated on the Main thread.

    You need to localize where NSWindow drag regions are invalidated and make sure that those happen in the Main thread.

    EDIT

    The asker explained that according to his/her findings, NSWindow drag regions only apply to Mac.