Disable on screen printing in Scene/SceneView
I've looked but I can't find anything about this. Does anyone know if there is a way to disable the on screen printing in a Scene/SceneView?
I'm referring to this: For debugging purposes, a SceneView will show standard output and exceptions in a “status line” at the bottom, so you can use print statements during development, even if your scene covers the whole screen.
(Actually this is only documented in SceneView, even though the feature is available when using Scene.run() to show a Scene. )
Sometimes printing stuff when running a script is useful, even when you don't want to see it directly on screen.
Can one also disable, move or alter the application close "X" in SceneView using a similar technique?
I should have mentioned that I am using Pythonista 3.0. I thought the hide_title_bar trick only worked in 2.0? I'll have to try...
@robnee if you're using
ui, it's the same.
hide_title_bar doesn't seem to work for me. I stripped it down to the example below. Am I doing something silly? I still get the close X in the upper right. I've even tried to figure this out by looking at the scene module source but no luck so I thought I'd ask here.
from scene import * def run2(scn): sv = SceneView() sv.scene = scn sv.present(hide_title_bar=True) run2(Scene())
SceneView may override some of the attributes. May be try this.
import scene, ui class MyScene(scene.Scene): def setup(self): self.label = scene.LabelNode('Test hide title bar', position=self.size/2, parent=self) #scene.run(MyScene()) ''' # This does not hide the close button scene_view = scene.SceneView() scene_view.scene = MyScene() scene_view.present('fullscreen', hide_title_bar=True) ''' # This works v = ui.View() scene_view = scene.SceneView() scene_view.flex= 'WH' scene_view.scene = MyScene() v.add_subview(scene_view) v.present('fullscreen', hide_title_bar=True)
abcabc, this does work although it's not exactly what I want because now the iOS titlebar is visible.
In the spirit of the answer to the original question I have managed to hack together a solution. It's ugly but I'm sure someone with more iOS and objective C experience can improve it. hide_close can both hide and show the close button. Note: once hidden the two finger swipe down does not seem to work so there is no way to close the scene.
class MyScene(scene.Scene): def setup(self): self.label = scene.LabelNode('Test hide title bar', position=self.size/2, parent=self) self.hide_close() def hide_close(self, state=True): from obj_util import ObjCInstance v = ObjCInstance(self.view) # Find close button. I'm sure this is the worst way to do it for x in v.subviews(): if str(x.description()).find('UIButton) >= 0: x.setHidden(state) scene.run(MyScene())
You can add a line to hide the ios status bar (discussed in a separate thread few days before) and you could have your own button to close the view. Here is the code to do these things.
Your solution also looks good.
import scene, ui from objc_util import UIApplication def close_view(): v.close() class MyScene(scene.Scene): def setup(self): self.test_label = scene.LabelNode('Test hide title bar', position=self.size/2.0, parent=self) self.close_label = scene.LabelNode('Close view', position=(self.size/2, self.size/2-100), parent=self) def touch_began(self, touch): if touch.location in self.close_label.frame: close_view() w, h = ui.get_window_size() frame = (0, 0, w, h) v = ui.View(frame=frame) scene_view = scene.SceneView(frame=frame) scene_view.flex= 'WH' scene_view.scene = MyScene() v.add_subview(scene_view) v.present('fullscreen', hide_title_bar=True) UIApplication.sharedApplication().statusBar().hidden = True
Interesting. I will give this a try as well. Thanks for your help!
Being able to twiddle with the objective C under the hood in Pythonista is fascinating.