最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - How to highlight each line of code in manim? - Stack Overflow

programmeradmin0浏览0评论

I am working on a coding tutorial and would like to show each line of code with a surrounded rectangle (color filled ofcourse) and display an action performed as each line of the code is highlighted.

I want my code to be on the left side of the screen and actions performed on the right side of the screen.

So far I have written my code in a seperate .py file and have visualized it using manim's Code class. But when I draw surrounded rectangles around each line of the code, the rectangles just wildly appear in the whole window. Can you please help me how to do it?

This is what I have done so far

code = Code("queueDS.py", language="python", insert_line_no=True, background="window", style="monokai", fill_color=BLUE)

for eachLine in code.code:
    surr = SurroundingRectangle(eachLine, color=BLUE, fill_opacity=0.5)
发布评论

评论列表(0)

  1. 暂无评论