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.
PythonistaKit dialogs.alert() buttons can't be pressed on real iPhone X (but it works in simulator?)
-
Hey All,
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?
-
Tell a lie- It doesn't work in the simulator either. Just doesn't work on iPhone X.
May have to dig down and do some debugging in the code for it
-
I do not believe this is related to iPhone X, but iOS 11. I have an iPhone 6 Plus. Once I updated to iOS11,
dialogs.alert()
broke (and other related dialogs). I know this because I updated to iOS 11 in the middle of this code development and noticed it immediately.You can have a simple message alert with an Ok button. Once the message comes up, I have to force quit Pythonista because the Ok button is not "clickable". It doesn't even highlight when touched. So it appears the app freezes, but not sure.
-
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! -
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
https://forum.omz-software.com/topic/1699/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.