我正在尝试将DrawBot(https://github.com/typemytype/drawbot)导入为模块,以在TouchDesigner中使用,并在Text Dat中运行脚本以将脚本创建的图形的预览呈现到普通窗口中({ 3}}导致错误:[quote] NSInternalInconsistencyException-NSWindow拖动区域仅应在主线程上无效![/ quote]脚本和错误在下面提供。
关于我做错了什么或可以尝试做的任何建议?
我还使用Terminal使用最新版本的Python3和在具有Python3.5.1的虚拟环境中运行了相同的代码,并且都成功运行了脚本,因此我认为这与直接在TD中运行脚本有关。导致错误。
感谢您的帮助。谢谢。
代码:
import vanilla
import drawBot
from drawBot.ui.drawView import DrawView
class PreviewController(object):
def __init__(self):
self.w = vanilla.Window((400, 400))
self.w.view = DrawView((0, 0, 0, 0))
self.drawSomeThing()
self.w.open()
def drawSomeThing(self):
# draw something
drawBot.newDrawing()
drawBot.newPage(300, 300)
drawBot.fill(1, 0, 0)
drawBot.rect(20, 20, 200, 200)
# get the pdf document
pdfDocument = drawBot.pdfImage()
drawBot.endDrawing()
# set the pdf document in the view
self.w.view.setPDFDocument(pdfDocument)
from vanilla.test.testTools import executeVanillaTest
executeVanillaTest(PreviewController)
```
错误:
Traceback (most recent call last):
File "</project1/text6:op('/project1/text6').run()>", line 1
td.Error: File "/project1/text6", line 40
File "/Users/gorjious/Desktop/virtualenv_test/py35_env/lib/python3.5/site-packages/vanilla-0.1-py3.5.egg/vanilla/test/testTools.py", line 43, in executeVanillaTest
cls(**kwargs)
File "/project1/text6", line 19, in __init__
File "/Users/gorjious/Desktop/virtualenv_test/py35_env/lib/python3.5/site-packages/vanilla-0.1-py3.5.egg/vanilla/vanillaWindows.py", line 132, in __init__
frame, mask, NSBackingStoreBuffered, False, screen)
objc.error: NSInternalInconsistencyException - NSWindow drag regions should only be invalidated on the Main Thread!
Results of run operation resulted in exception. Value:type:textDAT path:/project1/text6 Type:<class 'td.textDAT'>.