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.
Displaying to an external display stopped working.
-
I have an app that I created a few years back to teach in my classroom. The app is using dual display with an HDMI cable.
To get dual display to work I used the code from this post. When iOS 13 came I had to tweak the code to get it to work:
# second_window.setHidden(False) <<-- changed to second_windows.makeKeyAndVisible()
However, now with the newest update to iOS, every time the app tries to set the screen in the code for the second display, Pythonista completely crashes. I have tried the app store version and the beta version of Pythonista. So I am fairly sure that it is a change in the way iOS handles displaying to an external monitor. I checked the documentation but I still couldn't get it to work.
I don't know much about Objective-C so I am having a difficult time solving the issue. Any help or ideas would be appreciated.
-
@samfrank do you have some info about the crash reason?
-
The app crashes Pythonista to the iOS home screen without producing an error. If I debug through the code the line that causes the crash is:
second_window.setHidden(False)
. If I usemakeKeyAndVisible()
the crash still occurs. I wish I had more information to provide. Are there some hidden crash logs in Pythonista that I don't know about? -
@samfrank there is a file named _objc_exception.txt in the root of Pythonista
-
You could also install the marvelous script of @dgelessus from here
-
Thank you for your quick reply. I haven't tried the script yet, but the log contained the following:
This app was terminated due to an Objective-C exception. threading violation: expected the main thread
-
@samfrank ok, you have to put
@on_main_thread
just before the def calling the objectivec stuff. Could you post your code?
-
-
@cvp Thank you so much. It works perfectly! I learned a lot total about the Objective-C side of Pythonista, today.
I put the decorator
@objc_util.on_main_thread
on the function calling all of the second display code and now the app is running just like it used to before the iOS 13 updates.Thanks again!