根据主题,我如何将变量的值添加到图片中?
我有一个图像,我想添加一个变量的值,最好是一个单词的前后。
问题的主题可以从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)