Buttons not read from pyui
Installed pythonista yesterday and have got a very odd problem. It may well be a stupid one but as a noob I just can’t figure it out.
Have read the documentation but still puzzled.
I’m trying to read buttons from a pyui with no success at all, however if I run the example files they all work perfectly. I’ve even copied text directly intomy py files and they still don’t work
If I create labels, I can read and write to them ok but buttons just refuse to work
Altering the calculator py works but if I substitute my pyui file they stop working.
Is it my creation of a pyui that’s the problem?
I’m working on a brand new iPad Pro 2017 256mb os11.3.1
Apologies if this is covered elsewhere and pointers to solutions welcome
JonB last edited by
are you getting an error? or justactions are not being run? are you setting the action name in the pyui? are you sure you have those functions define before loading the pyui?
Post your pyui and script as a gist (share menu) and we can take a look
brumm last edited by
Have you read all the comments in the getting started section? Here Or do you create a pyui project with a separate pyui file? Then you could write e.g. button_tapped in the Action field in the button preferences.
import ui def button_tapped(sender): sender.title = 'Hello' v = ui.load_view() v.present('sheet')
Here is the code, I’ll work out how to do a gist and send the pyui from there
'@type sender: ui.Button'
# get button title
t = sender.title
v = ui.load_view('try')
No errors just nothing. The button on the sheet animates but the action in the py does nothing.
Pyui was created in pythonista. The examples work ok
I think that worked ok
Phuket2 last edited by
@Gadgettyke, looks like you just forgot to put your function name in action property of the button in the ui designer. ie button_action.
DOH!!! MANY THANKS
I just knew it would be a nooby mistake.
Must admit other than that I’d had very few difficulties in creating my app.
I Look forward to many hours of writing them.