forked from IV2FI/DrawBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickdraw_wrapper.py
More file actions
26 lines (22 loc) · 798 Bytes
/
quickdraw_wrapper.py
File metadata and controls
26 lines (22 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
from quickdraw import QuickDrawData
class quickDrawWrapper:
def __init__(self) -> None:
self.qd = QuickDrawData()
self.mName = self.matchName()
def matchName(self):
'''match translate name to english name'''
name = os.path.dirname(os.path.abspath(__file__)) + "\\colorPalettes\\names.txt"
res = dict()
for i, v in enumerate(open(name, encoding='utf8').read().split()):
res[v] = self.qd.drawing_names[i]
return res
def getDrawPosition(self, name):
if name in self.mName:
return self.qd.get_drawing(self.mName[name]).strokes
return None
if __name__ == '__main__':
# local test
qd = quickDrawWrapper()
for val in list(qd.mName.keys()):
qd.getDrawPosition(val)