简体   繁体   English

使用 Python 在框中创建带有一行数字的 PNG

[英]Create PNG with a row of numbers inside boxes with Python

How could I create, using python, a graphic with a row of numbers inside boxes and arrows crossing from one box to another (as in the image below)?我如何使用 python 创建一个图形,其中一排数字在方框内,箭头从一个方框交叉到另一个方框(如下图所示)? Then I'd like to save it as a PNG file.然后我想将它保存为PNG文件。

图形示例

The reason I'd like to use python is that I have to create this kind of graphics in bulks, varying the numbers inside the boxes.我想使用 python 的原因是我必须批量创建这种图形,改变盒子内的数字。

You can do this with pygame.您可以使用 pygame 执行此操作。 If you draw the boxes and text you can do pygame.image.save(Screen,'numbersandarrows.png')如果您绘制框和文本,您可以执行 pygame.image.save(Screen,'numbersandarrows.png')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM