-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsvgShow.py
More file actions
31 lines (19 loc) · 789 Bytes
/
svgShow.py
File metadata and controls
31 lines (19 loc) · 789 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
27
28
29
30
31
# -*- coding: utf-8 -*-
from Tkinter import *
from math import cos, sin
# разбор строки path из SVG-файла
svg1 = "M 215.71429,600.93361 170,423.79075 380,369.50504 450,520.93361 z" #нарисовать четыре точки и замкнуть
trim :: String -> String
trim = f . f
where f = reverse . dropWhile isSpace
splitPath :: String -> [String]
splitPath [] = []
splitPath (x:xs)
| [] <- xs = [[x]] --нужно, чтобы из чара сделать строку и вернуть элемент массива
| isSep x = [x : (trim (takeWhile (isNotSep) xs))] ++ (splitPath $ dropWhile (isNotSep) xs)
where
isSep x = x `elem` ['m', 'l', 'z']
isNotSep x = not $ isSep x
if __name__ == '__main__':
print splitSvg(svg1)
# show(svg1)