Se ofrecen a continuación unas posibles soluciones de los ejercicios SVG Brython (2).
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 1 1. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(11):
document["imagen"] <= svg.circle(cx=30*i, cy=150, r=5, fill="black")
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-10 -10 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 1 2. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(7):
document["imagen"] <= svg.circle(cx=50*i, cy=50*i, r=5, fill="green")
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-10 -10 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 1 3. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(6):
document["imagen"] <= svg.line(x1=0, y1=60*i, x2=300, y2=60*i, stroke="red", stroke_width=1)
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-10 -10 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 1 4. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(5):
document["imagen"] <= svg.line(x1=75*i, y1=75*i, x2=300, y2=0, stroke="blue", stroke_width=1)
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-10 -10 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 1 5. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(10):
document["imagen"] <= svg.rect(x=0, y=0, width=30+30*i, height=30+30*i,
stroke="peru", stroke_width=1, fill="none")
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-10 -10 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 1 6. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(7):
document["imagen"] <= svg.circle(cx=150, cy=150, r=30+30*i, stroke="olive", stroke_width=1, fill="none")
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-10 -10 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 2 1. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(10):
document["imagen"] <= svg.line(x1=-120+30*i, y1=120-30*i, x2=-120+30*i, y2=150,
stroke="black", stroke_width=1)
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-160 -160 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 2 2. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(11):
document["imagen"] <= svg.line(x1=-150+30*i, y1=-150, x2=-150, y2=150-30*i,
stroke="crimson", stroke_width=1)
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-160 -160 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 2 3. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(6):
document["imagen"] <= svg.line(x1=-150+20*i, y1=-150+60*i, x2=150-20*i, y2=-150+60*i,
stroke="saddlebrown", stroke_width=1)
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-160 -160 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 2 4. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(5):
document["imagen"] <= svg.circle(cx=0, cy=-120+30*i, r=30+30*i,
stroke="darkorchid", stroke_width=1, fill="none")
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-160 -160 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 2 5. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(10):
document["imagen"] <= svg.rect(x=-150+15*i, y=120-30*i, width=300-30*i, height=30,
stroke="seagreen", stroke_width=1, fill="none")
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-160 -160 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 2 6. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(5):
document["imagen"] <= svg.rect(x=-135+30*i, y=-15-30*i, width=270-60*i, height=30+60*i,
stroke="darkorange", stroke_width=1, fill="none")
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-160 -160 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 3 1. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(11):
document["imagen"] <= svg.line(x1=0, y1=150, x2=150, y2=30*i,
stroke="black", stroke_width=1)
document["imagen"] <= svg.line(x1=300, y1=150, x2=150, y2=30*i,
stroke="black", stroke_width=1)
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-10 -10 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 3 2. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(5):
document["imagen"] <= svg.line(x1=60*i, y1=60*i, x2=60+60*i, y2=60*i,
stroke="mediumseagreen", stroke_width=1)
document["imagen"] <= svg.line(x1=60+60*i, y1=60*i, x2=60+60*i, y2=60+60*i,
stroke="mediumseagreen", stroke_width=1)
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-10 -10 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 3 3. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(6):
document["imagen"] <= svg.line(x1=0, y1=50*i, x2=300, y2=25+50*i,
stroke="brown", stroke_width=1)
document["imagen"] <= svg.line(x1=0, y1=50+50*i, x2=300, y2=25+50*i,
stroke="brown", stroke_width=1)
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-10 -10 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 3 4. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(11):
document["imagen"] <= svg.line(x1=30*i, y1=0, x2=30*i, y2=300,
stroke="steelblue", stroke_width=1)
document["imagen"] <= svg.line(x1=0, y1=30*i, x2=300, y2=30*i,
stroke="steelblue", stroke_width=1)
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-10 -10 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 3 5. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(5):
document["imagen"] <= svg.rect(x=0, y=0, width=30+30*i, height=30+30*i,
stroke="blueviolet", stroke_width=1, fill="none")
document["imagen"] <= svg.rect(x=0, y=270-30*i, width=30+30*i, height=30+30*i,
stroke="blueviolet", stroke_width=1, fill="none")
document["imagen"] <= svg.rect(x=270-30*i, y=0, width=30+30*i, height=30+30*i,
stroke="blueviolet", stroke_width=1, fill="none")
document["imagen"] <= svg.rect(x=270-30*i, y=270-30*i, width=30+30*i, height=30+30*i,
stroke="blueviolet", stroke_width=1, fill="none")
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-10 -10 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>SVG (2) 3 6. Ejercicios SVG (2). Brython. Python. Bartolomé Sintes Marco</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.9.0/brython_stdlib.js"></script>
<script type="text/python3">
from browser import document
import browser.svg as svg
for i in range(6):
document["imagen"] <= svg.circle(cx=150, cy=0, r=50+50*i, stroke="hotpink", stroke_width=1, fill="none")
document["imagen"] <= svg.circle(cx=150, cy=300, r=50+50*i, stroke="hotpink", stroke_width=1, fill="none")
document["imagen"] <= svg.circle(cx=0, cy=150, r=50+50*i, stroke="hotpink", stroke_width=1, fill="none")
document["imagen"] <= svg.circle(cx=300, cy=150, r=50+50*i, stroke="hotpink", stroke_width=1, fill="none")
</script>
</head>
<body onload="brython()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="320" height="320" viewBox="-10 -10 320 320"
style="border: black 1px solid" id="imagen">
</svg>
</html>