知乎专栏 |
目录
pip3 install drawsvg -i https://pypi.tuna.tsinghua.edu.cn/simple pip3 install cairosvg -i https://pypi.tuna.tsinghua.edu.cn/simple
lines = draw.Lines( # 坐标 5, 5, # 横线 200, 5, # 竖线 200, 40, # 斜线 200 - 10, 20, # 横线2 5 + 10, 20, # 斜线 5, 40, # 闭合竖线 5,5, fill='none', stroke='black')
<!DOCTYPE html> <html> <body> <svg width="500" height="150"> <rect x="10" y="10" width="100" height="40" style="stroke: black; fill: silver; fill-opacity: .4;" onmouseover="this.style.stroke = 'blue'; this.style['stroke-width'] = 5;" onmouseout="this.style.stroke = 'green'; this.style['stroke-width'] = 1;" onclick="this.style['width'] = 300;" /> </svg> </body> </html>
<!DOCTYPE html> <html> <body> <input id="aa" type="text" value="200" onclick="svg.style['width']=this.value;" /> <svg width="500" height="150"> <rect id='svg' x="10" y="10" width="100" height="40" style="stroke: black; fill: silver; fill-opacity: .4;" onmouseover="this.style.stroke = 'blue'; this.style['stroke-width'] = 5;" onmouseout="this.style.stroke = 'green'; this.style['stroke-width'] = 1;" onclick="this.style['width'] = 300; aa.value='300'" /> </svg> </body> </html>