如何在 JES/Jython 中将变量的值添加到图片中?

How do I add a variable's value to a picture in JES/ Jython?

根据主题,如何将变量的值添加到图片?

我有一张图片,我想添加一个变量的值,最好在之前和/或之后添加一个词。

问题的主题可以从 Jython/Python 知识中得到回答,因为它们有时以相同的方式工作。

custom_text = "foo bar"

# addText(picture, xpos, ypos, text)
# add text "foo bar" to custom_picture, starting at (15, 50)
addText(custom_picture, 15, 50, custom_text)

# add text "kung-foo bar" to custom_picture2, starting at (40, 20)
addText(custom_picture2, 40, 20, "kung-" + custom_text)

new_custom_text = "kung-" + custom_text
# add text "kung-foo bar" to new_custom_picture, starting at (10, 30)
addText(new_custom_picture, 10, 30, new_custom_text)