AI mentor that corrects your written math visually with local harnesses.
Python
README: real demo of writing, marking and Show me in xournal++
Abdullah A.fe1c3835b7fc
diff --git a/README.md b/README.mdindex 6ca995b..f2ea492 100644--- a/README.md+++ b/README.md@@ -5,7 +5,9 @@ A maths mentor at the tip of your pen. Press a key while you work by hand: Claudteacher with coloured pens, gives you hints instead of answers, and shows the idea as a 3Blue1Brown-style animation.</p>-<p align="center"><img src="docs/showme.gif" alt="Show me: Riemann sums closing in on the integral of sin x from 0 to π" width="760"></p>+<p align="center"><img src="docs/demo.gif" alt="Writing an integral in xournal++, penmentor marking the sign slip, then animating the area" width="860"><br>+<sub>Handwriting in xournal++ → one key → the slip is marked on the page → box the integral → an interactive manim animation.+(<a href="docs/demo.mp4">video</a>; for a repeatable recording the pen is scripted and Claude's answer is a fixed example.)</sub></p>## Why I use itdiff --git a/docs/assets.py b/docs/assets.pyindex 7a85142..64ef68e 100644--- a/docs/assets.py+++ b/docs/assets.py@@ -1,11 +1,8 @@"""Renders the README's pictures with manim, the way penmentor draws its own:- ~/.local/share/penmentor/manim/bin/python docs/assets.py writes docs/banner.png and docs/showme.gif (needs ffmpeg)+ ~/.local/share/penmentor/manim/bin/python docs/assets.py writes docs/banner.png"""-import shutil-import subprocessimport sys-import tempfilefrom pathlib import PathDOCS = Path(__file__).resolve().parent@@ -43,34 +40,6 @@ def banner(out):scene.get_image().convert('RGB').crop((0, 360, 2560, 1080)).save(out) # the middle strip: 2560 x 720-class Recording(plot.Show):- """A Show-me window's intro, frame by frame."""-- def __init__(self, folder, **kw):- self.folder, self.n = folder, 0- super().__init__(**kw)-- def emit_frame(self):- self.get_image().convert('RGB').save(self.folder / f'{self.n:05d}.png')- self.n += 1---def gif(spec, out, seconds_after=1.5):- plot.cmu_serif()- with tempfile.TemporaryDirectory() as d:- scene = Recording(Path(d), spec=spec)- scene.setup()- scene.construct()- scene.wait(seconds_after) # hold the last frame a little- # two-pass palette: smooth gradients and crisp text at a sane size- subprocess.run(['ffmpeg', '-y', '-loglevel', 'error', '-framerate', '30', '-i', f'{d}/%05d.png', '-vf',- 'fps=20,scale=960:-1:flags=lanczos,split[a][b];[a]palettegen=max_colors=128:stats_mode=diff[p];'- '[b][p]paletteuse=dither=bayer:bayer_scale=4:diff_mode=rectangle', str(out)], check=True)--if __name__ == '__main__':- if not shutil.which('ffmpeg'):- sys.exit('needs ffmpeg')banner(DOCS / 'banner.png')- gif(dict(kind='riemann', f='sin(x)', a='0', b='pi', n=32, title=r'Riemann sums for $\int_0^\pi \sin x\,dx$'), DOCS / 'showme.gif')- print('wrote', DOCS / 'banner.png', DOCS / 'showme.gif')+ print('wrote', DOCS / 'banner.png')diff --git a/docs/demo.gif b/docs/demo.gifnew file mode 100644index 0000000..8877343Binary files /dev/null and b/docs/demo.gif differdiff --git a/docs/demo.mp4 b/docs/demo.mp4new file mode 100644index 0000000..47ce074Binary files /dev/null and b/docs/demo.mp4 differdiff --git a/docs/guide.md b/docs/guide.mdindex e663088..e9a7c76 100644--- a/docs/guide.md+++ b/docs/guide.md@@ -95,7 +95,7 @@ bin/penmentor --selftest # page analysis, text, formulas,bin/penmentor --test shot.png check # ask Claude about a saved screenshot: shot.penmentor.json and shot.penmentor.pngbin/penmentor --render shot.png shot.penmentor.json # redraw a saved answer without Claude (tune the visuals)PYTHONPATH=src ~/.local/share/penmentor/manim/bin/python -m penmentor.plot --png spec.json out.png # one animation's last frame-~/.local/share/penmentor/manim/bin/python docs/assets.py # the README's banner and GIF+~/.local/share/penmentor/manim/bin/python docs/assets.py # the README's banner```| Module | |diff --git a/docs/showme.gif b/docs/showme.gifdeleted file mode 100644index b95eb24..0000000Binary files a/docs/showme.gif and /dev/null differ