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.
Dual screen support...?
-
I'm pretty certain the answer is "no" (because otherwise I'd have found something when I tried searching the documentation) but is it possible to get Pythonista to send a different picture to a connected HDMI or AirPlay screen than is shown on the iPad's own screen.
I'm looking to prototype an educational app where the teacher has a control surface on the iPad which controls what is displayed on the classroom projector or interactive whiteboard.
(If Pythonista can't do it natively, I'll set up a Raspberry Pi as the classroom screen controller and write a simple control interface in Python to send HTTP requests to the Pi....)
-
Hi,
it's possible. Read this article from Apple about external display. Here's quickly hacked example ...
- create new script with UI, call it
hdmi
for example - add some UI controls (I did add label with Hallo HDMI text)
- create another script with UI, call it
main
for example - add some UI controls (I did add label with Hallo iPad text)
Code for the
hdmi.py
:import ui def load_view(): return ui.load_view()
Code for the
main.py
:import ui import hdmi import objc_util v = ui.load_view() v.present('sheet') UIScreen = objc_util.ObjCClass('UIScreen') if len(UIScreen.screens()) > 1: second_screen = UIScreen.screens()[1] bounds = second_screen.bounds() UIWindow = objc_util.ObjCClass('UIWindow') second_window = UIWindow.alloc().initWithFrame_(bounds) second_window.setScreen(second_screen) second_window.setHidden(False) hdmi_view = hdmi.load_view() hdmi_view_objc = objc_util.ObjCInstance(hdmi_view) hdmi_view_objc.setFrame(second_window.bounds()) second_window.addSubview(hdmi_view_objc)
Photo of both labels on iPad & my TV.
HTH,
Zrzka - create new script with UI, call it
-
Ooooh... neat.
I don't think I'll bother trying to implement the connection management at this stage -- it'll be a very early-stage prototype, and only I'll be using it, so I can do that manually.
Many thanks!
-
@Niall here's the gist which can be easily modified to be a module. Anyway it adds support for connected / disconnected screen notifications, custom handlers (optional), ... Just played with it and it works. You can find example how to use it at the bottom of this gist.
P.S. Sorry for the indentation (8), I dunno why, but GitHub cripples it even if I set just 2. Maybe Safari on iPad, dunno.