• robnee

    Hide_title_bar does not work for me. Not sure why people recommend it.

    This is a solution I came up with.

    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())
    

    posted in Pythonista read more
  • robnee

    Is Editorial still supported? It doesn't seem to be updated anymore.

    posted in Editorial read more
  • robnee

        def hide_close(self, state=True):
            from objc_util import ObjCInstance
            v = ObjCInstance(self.view)
            for x in v.subviews():
                #if 'UIButton' in x.description():
                if str(x.description()).find('UIButton') >= 0:
                    x.setHidden(state)
    

    This works better for me.

    posted in Pythonista read more
  • robnee

    Phuket2,

    No problem! I just felt like maybe I did a bad job of explaining my question so I wanted to restate. Thanks for offering to help. It why were all here :)

    posted in Pythonista read more
  • robnee

    Yes. I know there is a bug in the program. It's specifically designed to throw uncaught exceptions. Once an exception is thrown inside the controller_changed function however, it is remembered. Even after you fix the bug, any way you like perhaps by quoting the word 'bug', the exception will still be thrown with a reference to the old argument to print. You must force-quit Pythonista in order to reset the interpreter to make the code run again. The same thing does not seem to happen with touch_began. If you run, get the exception in touch_began, fix the bug, rerun, and tap the exception will not reoccur. Of course, this is the expected and desired behavior. It's something peculiar to controller_changed that seems to be the problem. Please try and see if this same thing happens to you.

    Rob

    posted in Pythonista read more
  • robnee

    I have a problem with Pythonista where, if I have a bug in my Scene.controller_changed function even after the bug is fixed the old exception will still be thrown every time controller_changed is called. This can be reset by force-quitting Pythonista. It's annoying because it makes you think your bug fixes aren't working.

    I'm happy to file an Issue for this but I thought it might be a good idea to ask if someone else can reproduce this. Notice the code below has two undefined name bugs. If you run this code you will get an exception on screen touch and pressing 'X' on a MFI controllers. Do this. Then fix both bugs by replacing bug with dog. Now when you run and tap the screen you should get a little 'woof' in the lower left-hand corner of the screen. However, when you press 'X' on a controller the old exception will still be thrown.

    Can someone with a MFI controller please try this and see if you can reproduce this?

    Rob

    '''This is trying to demonsrate a problem in Pythonista where an exception thrown inside controller_changed becomes "sticky" and will be rethrown even after the problem code is fixed.
    '''
    
    import scene
    
    dog = 'woof'
    
    
    class MyScene (scene.Scene):
        def touch_began(self, touch):
            print(bug)
        
        def controller_changed(self, id, key, value):
            if key == 'button_x' and value:
                print(bug)
    
        
    if __name__ == '__main__':
        scene.run(MyScene())
    

    posted in Pythonista read more
  • robnee

    abcabc,

    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.

    Rob

    posted in Pythonista read more
  • robnee

    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())
    
    

    posted in Pythonista read more
  • robnee

    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())
    

    posted in Pythonista read more
  • robnee

    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...

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!