ui as a displayable : Solved
Posted: Mon Jun 21, 2010 5:12 pm
My script contains a Python function that creates a ui.fixed depending on certain variables. Here's an oversimplified version of the function:
In my script, I do something like this:
The problem is that the image created by make_drawing() disappears after joe's dialog. I'd like to be able to make the code generate a displayable so that I could say (pseudo-code)
If someone can point me at the correct part of the reference manual to read, that would be great. Sample code would work for me too! 
Code: Select all
def make_drawing(a, b):
ui.fixed()
if (a < b):
ui.image("a.jpg", xpos=100, ypos=50)
else:
ui.image("b.jpg", xpos=150, ypos=20)
# more code involving loops and other stuff (not just a simple "if" statement)
ui.close()Code: Select all
$ make_drawing(3, 5)
joe "Wow, 3 really is less than 5."
fred "You got that right!"Code: Select all
$ displayable_thing = make_drawing(3, 5)
show displayable_thing
joe "Wow, 3 really is less than 5."
fred "Yes, and the diagram is still there, too!"