Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
imageView won't appear
-
I'm working on an app using the ui library, and have run into a problem. Given input from the user, I will produce a plot with matplotlib, which I then plan to have appear in an imageView. The problem is that nothing happens when I press the button that's supposed to make the plot appear. Below is my code:
import ui view = ui.View() view.height = 800 view.width = 500 view.name = 'Plot test' view.background_color = 'white' def plot_button(): img = ui.Image.named('plot.png') im = ui.ImageView() im.center = (view.width * 0.5, view.height*0.5) im.height = 350 im.width = 500 im.border_width = 2 im.flex = 'LRTB' im.image = img view.add_subview(im) go = ui.Button(title = 'Plot') go.action = plot_button go.width = 100 go.border_width = 1 go.border_color = 'grey' go.center = (view.width/8, 20) go.flex = 'LRTB' view.add_subview(go) view.present('fullscreen')
-
It should be
def plot_button(sender):
-
Perfect. Thanks.