Hello,
I am trying to import DrawBot (forum.drawbot.com/topic/26/usin … -drawbot/7)…this results in an error:
The script and the error are provided below.
Any suggestions of what I am doing wrong or what I can try?
I also ran the same code using Terminal with both the latest version of Python3 and in a virtual environment with Python3.5.1, and both run the script successfully so I assume this is something related to running the script in TD directly that is causing error.
Any help is appreciated. Thank you.
CODE:
[code]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)
ERROR:
[code]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'>.[/code]