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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
import svgwrite
dwg = svgwrite.Drawing('logo.svg', profile='tiny')
_size = 20
_fill = svgwrite.rgb(50, 50, 50, '%')
_stroke_width = 2
_GHDL = [
[
"01110",
"10001",
"10000",
"10111",
"10001",
"10001",
"01111"
],
[
"10001",
"10001",
"10001",
"11111",
"10001",
"10001",
"10001",
],
[
"11100",
"10010",
"10001",
"10001",
"10001",
"10010",
"11100"
],
[
"10000",
"10000",
"10000",
"10000",
"10000",
"10000",
"11111"
]
]
for idl, _letter in enumerate(_GHDL):
for idy, _row in enumerate(_letter):
for idx, val in enumerate(_row):
print(idl, idx, idy)
if val == '1':
dwg.add(dwg.rect(
(idl*_size*6 + idx*_size+_stroke_width, idy*_size+_stroke_width),
(_size-2*_stroke_width, _size-2*_stroke_width),
fill=_fill,
))
dwg.save()
|