PythonistaKit dialogs.alert() buttons can't be pressed on real iPhone X (but it works in simulator?)
I know PythonistaKit hasn't really seen much attention recently, but this one is strange as it works in the simulator (and on the App Store version of Pythonista).
I'm upgrading by app for iPhone X and for some reason I can't press any of the buttons on a dialog box generated with dialogs.alert(). The dialog can be dismissed by keyboard if it has a text field.
Anyone have any idea what may have changed and what I could do to troubleshoot this?
For example, this will freeze up...
dialogs.alert('hello world', 'test', 'Ok', hide_cancel_button=True)
@donnieh Hmm, I can't reproduce this. That line works fine here, just tested this both in the App Store version and the beta (on iOS 11).
Is this the entire code that causes the freezing?
Doesn’t seem like iPhone X issue. I just tested this on mine, trying different combinations of buttons and options. All works fine for me
@omz Fair enough. Here is my exact code...
class Home_page: def __init__(self): pass def Info_tap(self, sender=None): dialogs.alert('Opamp Pro v1.0', '\nA circuit rich design calculator for iOS.\n\nDonnie Herman, 2016-2017 \nWestern NY','OK', hide_cancel_button=True)``` If you send me an email, I will reply with entire source code. (I don’t want to post all my code here)
This post is deleted!last edited by
Does it on iPhone 6S and 7 too. Definitely iOS related. Dialogs is definitely broke, but not sure why it works for some people.
I looked up the documentation for dialog.alert, and was directed to look at console.alert.
I found this topic from 3 years ago about a similar hang with console.alert.
console.alert with SceneView
Adding @ui.in_background before the method(s) fixed it!
I used @ui.in_background before but I was threw off by it working, then not working out of nowhere.
Created some stub methods decorated with ui.in_background and that did indeed fix it- so thanks :)
Now just to work out this more difficult "code signing" issue with the .py files :/
Guys, did the real problem get solved here or just a work around? It seems to me that the dialogs module should be updated to deal with this. I am not sure I am right, but it seems that way. If so, I can create an issue on the github repo issues. I just want to make sure I understand before I create an issue on the repo.
Wouldn't say the real issue is resolved, there should probably be a fixed default behavior here in Pythonista.
I've also had problems using this workaround with input_alert() - if I decorate with @ui.in_background then I get :
Main Thread Checker: UI API called on a background thread: -[UIView subviews]
Works with @on_main_thread
Maybe one of the guys here that understands this problem more in depth could raise an issue on the Pythonista issues repo. To me it seems like that the dialogs module and console module etc... could have the decorators in place that avoids these issues when using the API in a straight forward way. But I am guessing about that. For example, I dont understand exactly why these issues are getting more prevalent. I.e is it changes to iOS or is the processing speed of the devices etc? Because this stuff worked for a long time without these issues.
Eg, I often pass animated=False to ui.Present. This can create problems, but only sometimes on the same device. You can avoid the problems using a delay, but using the decorator might also fix it. But it gets complicated and hard to debug if you are not aware of the behaviour
Any update on this? I had a dialog (dialogs.alert) with 2 buttons that was working, now it is behaving like this... the buttons are now non-responsive. I have to kill the app. The dialog was wrapped in a function. I decorated the function with @ui.in_background and that caused the dialog to not appear at all.
It was working on my Iphone 8 and my Ipad pro... now it is not working on either.
Dialogs.alert with only "OK" and hide_cancel_button=True seem to work fine.