pythonimagevariablesjythonjes

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


As per the topic, How do I add a variable's value to a picture?

I have an image I want to add a variable's value to, and prefferably a word before and/ or after.

The question's topic may be answerable from Jython/ Python knowledge as they sometimes work the same way.


Solution

  • 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)