How to label geometric shapes
include "g"
w = Window[][
// Styles for drawing the main triangle (s1) and the squares (s2)
s1 = Style[Color[color.red, .a=0.3], Border[0.5, color.black]]
s2 = Style[Color[color.blue, .a=0.3], Border[0.5, color.black]]
t = Poly[s1, (0, 0), (0, 30), (50, 0)] // Main triangle
// The three squares
dx = 1e-6
sq1 = Poly[s2, t.Get[0], t.Get[1], t.Get[(1-dx, 1)], t.Get[(0, 1)]]
sq2 = Poly[s2, t.Get[1], t.Get[2], t.Get[(2-dx, 1)], t.Get[(1, 1)]]
sq3 = Poly[s2, t.Get[2], t.Get[0], t.Get[(0-dx, 1)], t.Get[(2, 1)]]
// Send the shapes to the window for drawing
t, sq1, sq2, sq3
Texts[Font["Times-Italic", 8, color.black]
"a^2", t.Get[(0.5, 0.5)];
"c^2 = a^2 + b^2", t.Get[(1.5, 0.5)];
"b^2", t.Get[(2.5, 0.5)];]
]
w.Save["pythagoras.png", Window["rgb24", .Res[Dpi[80]]]]