• mrcoxall

    @omz Thanks for getting back to me.

    I was wondering if there is any explanation on why it is no longer possible?
    I used Pythonista last year with my grade 11 programming course and got over a dozen apps published on the App Store. I have just started using it again with this years group and told them we will be doing the same thing. If there is anything I can do to help the process along, please let me know. We will not be starting to write the final apps until December.

    Thanks

    posted in Pythonista read more
  • mrcoxall

    In January I was successful at getting several apps onto the App Store.
    I just went back to load another one and I am now getting a Code Signing Error.
    I cleared out all my certificates and reloaded everything to ensure something had not expired.
    I even loaded an app built completely in Xcode and it worked fine.
    When I try using the Pythonista template I get:

    ERROR ITMS-90035: "Invalid Signature. Code object is not signed at all. The file at path [My App.app/Frameworks/PythonistaKit.framework/pylib/future.py] is not properly signed. Make sure you have signed your application with a distribution certificate, not an ad hoc certificate or a development certificate. Verify that the code signing settings in Xcode are correct at the target level (which override any values at the project level). Additionally, make sure the bundle you are uploading was built using a Release target in Xcode, not a Simulator target. If you are certain your code signing settings are correct, choose "Clean All" in Xcode, delete the "build" directory in the Finder, and rebuild your release target. For more information, please consult https://developer.apple.com/library/ios/documentation/Security/Conceptual/CodeSigningGuide/Introduction/Introduction.html"
    ERROR ITMS-90035: "Invalid Signature. Code object is not signed at all. The file at path [My App.app/Frameworks/PythonistaKit.framework/pylib/future.py] is not properly signed. Make sure you have signed your application with a distribution certificate, not an ad hoc certificate or a development certificate. Verify that the code signing settings in Xcode are correct at the target level (which override any values at the project level). Additionally, make sure the bundle you are uploading was built using a Release target in Xcode, not a Simulator target. If you are certain your code signing settings are correct, choose "Clean All" in Xcode, delete the "build" directory in the Finder, and rebuild your release target. For more information, please consult https://developer.apple.com/library/ios/documentation/Security/Conceptual/CodeSigningGuide/Introduction/Introduction.html"

    Anybody else getting this?
    Anyone have a solution?

    posted in Pythonista read more
  • mrcoxall

    That works and I get the new view.
    Problem is it looks like Pythonista is trying to load the buttons that are defined in the second *.pyui file, but the first *.py file does not have any reference to them. The are in the second *.py file.

    Warning: Could not bind action: name 'calculate_button_touch_up_inside' is not defined
    Warning: Could not bind action: name 'clear_button_touch_up_inside' is not defined

    posted in Pythonista read more
  • mrcoxall

    Is there a way to be in one *.py file with its corresponding *.pyui file that creates the GUI.
    Then you click a button and go to another *.py with its corresponding *.pyui file?

    posted in Pythonista read more
  • mrcoxall

    Wondering if anyone has been able to submit an app successfully since Jan 1, 2017.
    I still am getting signing errors and have no workaround that will work.
    I have app waiting to get approved and need a solution.

    Thanks

    posted in Pythonista read more
  • mrcoxall

    @omz I tried as you suggest and used the Application Loader. Same problem happening. Still getting code signing errors. Have tried using "Auto code signing" and even old school downloading the certificate myself and still getting the same messages.
    Have you been able to get anything uploaded to the App Store?
    Do you have a template that I could try?

    Thanks

    posted in Pythonista read more
  • mrcoxall

    @omz I have used your script and changed all the files in pylib and pylib_ext. I even placed the header at the top of the files in "scripts". It still compiles OK to simulator and devices but I am still getting a code signing error.

    error screenshot

    Any ideas?
    Here is my fork with the fix: https://github.com/Mr-Coxall/PythonistaAppTemplate

    posted in Pythonista read more
  • mrcoxall

    @omz Thanks so much for getting back to me.
    I will give it a try and see what happens.

    By any chance do you have an update to the GitHub repo with the changes already made to the pylib and pylib_ext, so that I do not have to run the scrip and change anything?

    Thanks again, Patrick

    posted in Pythonista read more
  • mrcoxall

    I am trying to upload a Pythonista project to the Apple App Store.
    I have tried many, many time and keep getting code signing errors.
    I am using Xcode 8.2.1
    So this is what I have done:

    Started with new Xcode Swift single view project, archived it and was able to submit it to the App Store. So my certificates are all working. I downloaded the Xcode template and then archived it. When I submit to Apple, it hangs on the code signing for a really long time and then comes back with this error:

    ERROR ITMS-90035: "Invalid Signature. Code object is not signed at all. Make sure you have signed your application with a distribution certificate, not an ad hoc certificate or a development certificate. Verify that the code signing settings in Xcode are correct at the target level (which override any values at the project level). Additionally, make sure the bundle you are uploading was built using a Release target in Xcode, not a Simulator target. If you are certain your code signing settings are correct, choose "Clean All" in Xcode, delete the "build" directory in the Finder, and rebuild your release target. For more information, please consult https://developer.apple.com/library/ios/documentation/Security/Conceptual/CodeSigningGuide/Introduction/Introduction.html"

    The only thing I can figure out is that it seems to be trying to code sign the PythonistaKit.framework and does not seem to be able to. I can see "PythonistaKit.framework (0 Entitlements), just before I validate it.

    Wondering if anyone else is able to reproduce this error, or even better have a fix to the problem.
    Thanks

    posted in Pythonista read more
  • mrcoxall

    Using this with the Git2Go app.
    I can move files from Pythonista to Git2Go and then to GitHub and back again.
    This works great.

    Then I wanted a way to update a file in Pythonista from Git2Go.
    This script works great, ... but.
    Is there a way to actually select where the file will be saved, instead of just dropping it in an "inbox" folder and then having to move it to the right location?

    Thanks

    posted in Pythonista read more
  • mrcoxall

    @Cethric
    Works great.
    Thanks

    posted in Pythonista read more
  • mrcoxall

    I am using the scene module to make a game. When I hit a button, I have a missile moving up the screen. When it goes off the screen, I would like to remove it from my array and memory, to clear up memory and since in the game the missile is gone.

    I have tried many things and it does not seem to remove it right away, and then tries to remove more than one. Not sure what I am doing wrong. At line 80.

    Here is the Gist: https://gist.github.com/cb0ac079b7351e2b59e980237a546152

    # Created by: Mr. Coxall
    # Created on: Sep 2016
    # Created for: ICS3U
    # This program is the first file in a multi-scene game template
    #    This template is meant to be used with the Xcode 
    
    from scene import *
    import ui
    from numpy import random
    from copy import deepcopy
    
    class FirstScene(Scene):
        def setup(self):
            # this method is called, when user moves to this scene
            
            self.size_of_screen = deepcopy(self.size)
            self.center_of_screen = deepcopy(self.size/2)
            self.left_button_down = False
            self.right_button_down = False
            self.ship_move_speed = 40.0
            self.missiles = []
            self.aliens = []
            self.alien_attack_rate = 1
            self.alien_attack_speed = 20.0
            
            # add blue background color
            self.background = SpriteNode(position = self.size / 2, 
                                         color = (0.61, 0.78, 0.87), 
                                         parent = self, 
                                         size = self.size)
            
            spaceship_position = deepcopy(self.center_of_screen)
            spaceship_position.y = 100
            self.spaceship = SpriteNode('spc:PlayerShip1Orange',
                                        parent = self,
                                        position = spaceship_position)
            
            left_button_position = deepcopy(self.center_of_screen)
            left_button_position.x = 75
            left_button_position.y = 75
            self.left_button = SpriteNode('iob:arrow_left_a_256',
                                          parent = self,
                                          scale = 0.5,
                                          position = left_button_position,
                                          alpha = 0.5)
            
            right_button_position = deepcopy(self.center_of_screen)
            right_button_position.x = 200
            right_button_position.y = 75
            self.right_button = SpriteNode('iob:arrow_right_a_256',
                                           parent = self,
                                           scale = 0.5,
                                           position = right_button_position,
                                           alpha = 0.5)
            
            fire_button_position = deepcopy(self.size)
            fire_button_position.x = fire_button_position.x - 75
            fire_button_position.y = 75
            self.fire_button = SpriteNode('iob:disc_256',
                                          parent = self,
                                          scale = 0.5,
                                          position = fire_button_position,
                                          alpha = 0.5)
            
        def update(self):
            # this method is called, hopefully, 60 times a second
            
            # move spaceship if button down
            if self.left_button_down == True:
                spaceshipMove = Action.move_by(-1*self.ship_move_speed, 
                                               0.0, 
                                               0.1)
                self.spaceship.run_action(spaceshipMove)
            if self.right_button_down == True:
                spaceshipMove = Action.move_by(self.ship_move_speed, 
                                               0.0, 
                                               0.1)
                self.spaceship.run_action(spaceshipMove)
            
            # check every update if a missile is off screen
            print('A: ' + str(range(len(self.missiles))))
            for missile_index in range(len(self.missiles)):
               
               if self.missiles[missile_index].position.y > self.size_of_screen.y - 100:
                   #self.missiles[missile_index].remove_all_actions()
                   #self.missiles[missile_index].remove_from_parent()
                   print('B: ' + str(missile_index) + ' ' + str(len(self.missiles)))
                   #print(missile_index)
                   self.missiles.remove(missile_index)
                   #print('one success')
                   break
                   #print(len(self.missiles))
            
        def touch_began(self, touch):
            # this method is called, when user touches the screen
            
            # check if left or right button is down
            if self.left_button.frame.contains_point(touch.location):
                self.left_button_down = True
            
            if self.right_button.frame.contains_point(touch.location):
                self.right_button_down = True
        
        def touch_moved(self, touch):
            # this method is called, when user moves a finger around on the screen
            pass
        
        def touch_ended(self, touch):
            # this method is called, when user releases a finger from the screen
            
            # if I removed my finger, then no matter what spaceship
            #    should not be moving any more
            self.left_button_down = False
            self.right_button_down = False
            
            # if fire button pressed, create a new missile
            if self.fire_button.frame.contains_point(touch.location):
                self.create_new_missile()
            
        def create_new_missile(self):
            # when the user hits the fire button
            
            missile_start_position = deepcopy(self.spaceship.position)
            missile_start_position.y = 100
            
            missile_end_position = deepcopy(self.size)
            missile_end_position.x = missile_start_position.x
            
            self.missiles.append(SpriteNode('spc:Fire1',
                                 position = missile_start_position,
                                 parent = self))
            
            # make missile move forward
            missileMoveAction = Action.move_to(missile_end_position.x, 
                                               missile_end_position.y + 100, 
                                               1.0)
            self.missiles[len(self.missiles)-1].run_action(missileMoveAction)
            
    
    #  ..use when deploying app for Xcode and the App Store
    main_view = ui.View()
    scene_view = SceneView(frame = main_view.bounds, flex = 'WH')
    main_view.add_subview(scene_view)
    scene_view.scene = FirstScene()
    main_view.present(hide_title_bar = True, animated = False)
    
    ~~~
    
    Thanks

    posted in Pythonista read more
  • mrcoxall

    @Cethric said:

    @ui.in_background
    Works great.
    Thanks so much

    posted in Pythonista read more
  • mrcoxall

    I know there are better ways to do this, I am just wanting to do this as an example.

    I want to take an image view and rotate through several images in a loop.
    I found that the command sets_needs_display(), but it does not seem to refresh the images

    import ui
    import time
    
    # first get a reference to the image you saved in your Python folder
    walking_man_image = ui.Image.named('./assests/sprites/image1.BMP')
    walking_man_imageview = ui.ImageView(frame=(30, 0, 180, 180))
    walking_man_imageview.image = walking_man_image
    
    
    def start_button_touch_up_inside(sender):
        image_counter = 1
        while image_counter <= 10:
            if image_counter == 1:
                walking_man_image = ui.Image.named('./assests/sprites/image1.BMP')
                walking_man_imageview.image = walking_man_image
            elif image_counter == 2:
                walking_man_image = ui.Image.named('./assests/sprites/image2.BMP')
                walking_man_imageview.image = walking_man_image
            elif image_counter == 3:
                walking_man_image = ui.Image.named('./assests/sprites/image3.BMP')
                walking_man_imageview.image = walking_man_image
            elif image_counter == 4:
                walking_man_image = ui.Image.named('./assests/sprites/image4.BMP')
                walking_man_imageview.image = walking_man_image
        
            # now wait for a fraction of second
            time.sleep(0.2)
            
            image_counter = image_counter + 1
            #print(image_counter)
            view.set_needs_display()
    
    view = ui.load_view()
    
    # lastly, add the Imageview into the existing view
    view.add_subview(walking_man_imageview)
    
    view.present('sheet')
    

    posted in Pythonista read more
  • mrcoxall

    @ccc I was wondering if there was a Pythonista 2 version of this script somewhere?

    https://github.com/cclauss/Pythonista-and-Working-Copy

    posted in Pythonista read more
  • mrcoxall

    I have been trying different versions of Gist and Github downloaders and came up with the following solution after combining several together. It works with both Gists and Github repos. It does work with Unicode and it runs nicely from the sharesheet with some prompts to tell you what it is doing.

    URL: https://gist.github.com/Mr-Coxall/7fbf6dc0ec3d83525f1944812ccce46f

    # Created by: jsbain
    # Created on: Aug 2014
    # URL : https://github.com/jsbain/GitHubGet/blob/master/GitHubGet.py
    
    # download an entire github repo.
    # either copy the url to clipboard, and run script, or run following bookmarklet.  
    # will unzip to repo-branch (so be careful if downloading same branch name from multiple users)
    # 
    ##   javascript:(function()%7Bif(document.location.href.indexOf('http')===0)document.location.href='pythonista://GitHubGet?action=run&argv='+document.location.href;%7D)();
    
    # Altered by: Mr. Coxall
    # Altered on: Aug 2016
    # Combined with other code, so that it will only work from sharesheet 
    #     and gives the user different and better feedback
    # Also places the files in Downloaded from Github directory
    # This works not only with Github repos but also Gists.
    
    import requests
    import appex, console, time, os
    import urllib, zipfile, sys, functools, re, os, tempfile
    #import urllib,zipfile,sys, clipboard, functools, re, os, tempfile
    
    def extract_git_id(git):
        #print git
        m = re.match((r'^http(s?)://([\w-]*\.)?github\.com/(?P<user>[\w-]+)/(?P<repo>[\w-]*)'
                     '((/tree|/blob)/(?P<branch>[\w-]*))?'), git)
    #    print m.groupdict()
        return m
        
    def git_download_from_args(args):
        if len(args) == 2:
            url = args[1]
        else:
            url = clipboard.get()
            #print(url)
        git_download(url)
        
    def git_download_from_sharesheet():
        if appex.is_running_extension():
            #unquote=requests.utils.unquote
            #urlparse=requests.utils.urlparse
            url = appex.get_url()
            #print(url)
            git_download(url)
        else:  # Error handling...
            print('''=====
    * In Safari browser, navigate to a GitHub repo or Gist of interest.
    * Tap 'Open in...' icon in top right of Safai window.
    * Tap 'Run Pythonista Script'.
    * Pick this script and tap the run button.
    * When you return to Pythonista the files should be in '~/Documents/Downloaded from Github/'.''')
    
    
    def dlProgress(filename, count, blockSize, totalSize):
        if count*blockSize > totalSize:
            percent=100
        else:
            percent = max(min(int(count*blockSize*100/totalSize),100),0)
        sys.stdout.write("\r" + filename + "...%d%%" % percent)
        sys.stdout.flush()
    
    def git_download(url):
        base = 'https://codeload.github.com'
        archive = 'zip'
        m = extract_git_id(url)
        if m:
            g = m.groupdict()
            if not g['branch']:
                g['branch'] = 'master'
    
            u = '/'.join((base,g['user'],g['repo'],archive, g['branch']))
            #print u
            #console.hud_alert('Downloading Github repo ...' + u)
            console.hud_alert('Starting, please wait.')
            console.show_activity()
            try:
                with tempfile.NamedTemporaryFile(mode='w+b',suffix='.zip') as f:
                    console.hud_alert('Downloading the zip.')
                    urllib.urlretrieve(u,f.name,reporthook=functools.partial(dlProgress,u))
                    
                    z = zipfile.ZipFile(f)
                    githubpath = os.path.expanduser('~/Documents/Downloaded from Github/')
                    if not os.path.exists(githubpath):
                        os.mkdir(githubpath)
                    z.extractall(path = githubpath)
                    console.hud_alert('Extracting zip.')
                    print z.namelist()
            except:
                print('git url did not return zip file')
            console.hud_alert('Files saved in "Downloaded from Github" directory.')
            console.hud_alert('All done.')
        else:
            print('could not determine repo url from clipboard or argv')
            
    if __name__=='__main__':
        #git_download_from_args(sys.argv)
        git_download_from_sharesheet()
    

    posted in Pythonista read more
  • mrcoxall

    Works great.
    Thanks so much.

    Patrick

    posted in Pythonista read more
  • mrcoxall

    The following is the best I have been able to come up with as a template for scene management. I have a timer for the fist scene. Unfortunately I cannot get one working for the second.

    I am still looking for a "non-modal" way to present a scene or a way to completely remove a scene, so that it is no longer running.
    Thanks again for any help.

    # for use with https://github.com/omz/PythonistaAppTemplate
    
    from scene import *
    import ui
    import time
    
    class FirstScene (Scene):
    
        # global variable to class
        start_time = None
           
        def setup(self):
            # add background color
            self.background = SpriteNode(color = 'white')
            self.background.size = self.size
            self.background.position = self.size / 2
            self.add_child(self.background)
            
            # get starting time
            global start_time
            start_time = time.time() 
                   
            self.ship = SpriteNode('test:Pythonista')
            self.ship.position = self.size / 2
            self.ship.size = self.size
            self.add_child(self.ship)
            
        def update(self):
            # move to new scene after 2 second
            # problem is it keeps happening, since it is modal
            # is there a way to actually really dispose 
            # of a scene and then move forward?
                  
            current_time = time.time()
            
            #global scene_moved_away_from
            if current_time - start_time > 2:
                self.present_modal_scene(second_scene)
    
        def touch_began(self, touch):
            #self.present_modal_scene(second_scene)
            pass
            
        def touch_moved(self, touch):
            pass
            
        def touch_ended(self, touch):
            if self.ship.frame.contains_point(touch.location):
                self.present_modal_scene(second_scene)
            
            
    class SecondScene (Scene):
    
        # global variable to class
        start_time = None
        
        def setup(self):
            # add background color
            self.background = SpriteNode(color = 'green')
            self.background.size = self.size
            self.background.position = self.size / 2
            self.add_child(self.background)
            
            start_time = time.time()
            
            self.ship = SpriteNode('spc:EnemyGreen2')
            self.ship.position = self.size / 2
            self.add_child(self.ship)
            
        def update(self):
            # move to new scene after 2 second
            current_time = time.time()
            
            # have to comment out because get "max recursion error"
            # code keeps reloading first then second scene over and
            # over again, since time has lapsed
            #if current_time - start_time > 2:
                #self.present_modal_scene(second_scene)
                #pass
    
        def touch_began(self, touch):
            self.pause = True
            self.present_modal_scene(main_menu_scene)
            
        def touch_moved(self, touch):
            pass
            
        def touch_ended(self, touch):
            pass
        
        
    class MainMenuScene (Scene):
        
        def setup(self):
            # add background color
            self.background = SpriteNode(color = 'blue')
            self.background.size = self.size
            self.background.position = self.size / 2
            self.add_child(self.background)
            
            self.ace = SpriteNode('card:ClubsA')
            self.ace.position = (683.0, 512.0)
            self.add_child(self.ace)
            
            self.king = SpriteNode('card:ClubsK')
            self.king.position = (683.0, 750.0)
            self.add_child(self.king)
            
            self.queen = SpriteNode('card:ClubsQ')
            self.queen.position = (683.0, 238.0)
            self.add_child(self.queen)
            
        def update(self):
            pass
    
        def touch_began(self, touch):
            pass
            
        def touch_moved(self, touch):
            pass
            
        def touch_ended(self, touch):
            # move to new scenes
            if self.ace.frame.contains_point(touch.location):
                self.present_modal_scene(a_scene)
            elif self.king.frame.contains_point(touch.location):
                self.present_modal_scene(b_scene)
            elif self.queen.frame.contains_point(touch.location):
                self.present_modal_scene(c_scene)
            
            
    class AScene (Scene):
        
        def setup(self):
            # add background color
            self.background = SpriteNode(color = 'white')
            self.background.size = self.size
            self.background.position = self.size / 2
            self.add_child(self.background)
             
            self.blue_card = SpriteNode('card:BackBlue1')
            self.blue_card.position = self.size / 2
            self.add_child(self.blue_card)
            
        def update(self):
            pass
    
        def touch_began(self, touch):
            pass
            
        def touch_moved(self, touch):
            pass
            
        def touch_ended(self, touch):
            # moving back to previous scene, so remove modal makes sense
            if self.blue_card.frame.contains_point(touch.location):
                self.dismiss_modal_scene()
    
    
    class BScene (Scene):
        
        def setup(self):
            # add background color
            self.background = SpriteNode(color = 'white')
            self.background.size = self.size
            self.background.position = self.size / 2
            self.add_child(self.background)
            
            self.green_card = SpriteNode('card:BackGreen1')
            self.green_card.position = self.size / 2
            self.add_child(self.green_card)
            
        def update(self):
            pass
    
        def touch_began(self, touch):
            pass
            
        def touch_moved(self, touch):
            pass
            
        def touch_ended(self, touch):
            # moving back to previous scene, so remove modal makes sense
            if self.green_card.frame.contains_point(touch.location):
                self.dismiss_modal_scene()
    
    
    class CScene (Scene):
        
        def setup(self):
            # add background color
            self.background = SpriteNode(color = 'white')
            self.background.size = self.size
            self.background.position = self.size / 2
            self.add_child(self.background)
            
            self.red_card = SpriteNode('card:BackRed1')
            self.red_card.position = self.size / 2
            self.add_child(self.red_card)
            
        def update(self):
            pass
    
        def touch_began(self, touch):
            pass
            
        def touch_moved(self, touch):
            pass
            
        def touch_ended(self, touch):
            # moving back to previous scene, so remove modal makes sense
            if self.red_card.frame.contains_point(touch.location):
                self.dismiss_modal_scene()
    
    
    first_scene = FirstScene()
    second_scene = SecondScene()
    main_menu_scene = MainMenuScene()
    a_scene = AScene()
    b_scene = BScene()
    c_scene = CScene()
    # Instead of...
    # run(MyScene())
    
    # ..use:
    main_view = ui.View()
    scene_view = SceneView(frame=main_view.bounds, flex='WH')
    main_view.add_subview(scene_view)
    scene_view.scene = first_scene
    main_view.present(hide_title_bar=True, animated=False)
    

    posted in Pythonista read more
  • mrcoxall

    Thanks again to everyone for their help, I am getting close to a "scene solution" I can use.

    The problem I have now is, I would like to use a timer, so that after a second it automatically moves to the next scene. I would like to use it for a splash screen at the beginning. Because it is modal though, the scene is still running in the background.

    Is there any way to not have it modal or to actually really completely remove the scene, so it is not running and then go to the new one? There will be some scenes I will only ever use once, so removing them from memory would be the best.

    # for use with https://github.com/omz/PythonistaAppTemplate
    
    from scene import *
    import ui
    import time
    
    class FirstScene (Scene):
    
        # global variable to class
        start_time = None
        
        def setup(self):
            # add background color
            self.background = SpriteNode(color = 'white')
            self.background.size = self.size
            self.background.position = self.size / 2
            self.add_child(self.background)
            
            # get starting time
            global start_time
            start_time = time.time() 
            
            self.ship = SpriteNode('spc:PlayerShip1Orange')
            self.ship.position = self.size / 4
            self.add_child(self.ship)
            
        def update(self):
            # move to new scene after 1 second
            # problem is it keeps happening, since it is modal
            # is there a way to actually really dispose 
            # of a scene and then move forward?
            
            current_time = time.time()
            if current_time - start_time > 1:
                #self.present_modal_scene(second_scene)
                pass
    
        def touch_began(self, touch):
            #self.dismiss_modal_scene()
            #self.present_modal_scene(second_scene)
            pass
            
        def touch_moved(self, touch):
            pass
            
        def touch_ended(self, touch):
            if self.ship.frame.contains_point(touch.location):
                self.present_modal_scene(second_scene)
            
            
    class SecondScene (Scene):
        
        # global variable to class
        start_time = None
        
        def setup(self):
            # add background color
            self.background = SpriteNode(color = 'green')
            self.background.size = self.size
            self.background.position = self.size / 2
            self.add_child(self.background)
            
            # get starting time
            global start_time
            start_time = time.time()
            
            self.ship = SpriteNode('spc:EnemyGreen2')
            self.ship.position = self.size / 2
            self.add_child(self.ship)
            
        def update(self):
            # move to new scene after 1 second
            current_time = time.time()
            if current_time - start_time > 1:
                #self.present_modal_scene(second_scene)
                pass
    
        def touch_began(self, touch):
            
            self.present_modal_scene(main_menu_scene)
        
        
    class MainMenuScene (Scene):
        def setup(self):
            # add background color
            self.background = SpriteNode(color = 'blue')
            self.background.size = self.size
            self.background.position = self.size / 2
            self.add_child(self.background)
            
            self.ace = SpriteNode('card:ClubsA')
            self.ace.position = (683.0, 512.0)
            self.add_child(self.ace)
            
            self.king = SpriteNode('card:ClubsK')
            self.king.position = (683.0, 750.0)
            self.add_child(self.king)
            
            self.queen = SpriteNode('card:ClubsQ')
            self.queen.position = (683.0, 238.0)
            self.add_child(self.queen)
            
        def update(self):
            pass
    
        def touch_began(self, touch):
            #self.dismiss_modal_scene()
            #self.present_modal_scene(a_scene)
            pass
            
        def touch_moved(self, touch):
            pass
            
        def touch_ended(self, touch):
            # move to new scenes
            if self.ace.frame.contains_point(touch.location):
                self.present_modal_scene(a_scene)
            elif self.king.frame.contains_point(touch.location):
                self.present_modal_scene(b_scene)
            elif self.queen.frame.contains_point(touch.location):
                self.present_modal_scene(c_scene)
            
            
    class AScene (Scene):
        def setup(self):
            # add background color
            self.background = SpriteNode(color = 'white')
            self.background.size = self.size
            self.background.position = self.size / 2
            self.add_child(self.background)
             
            self.a_choise = SpriteNode('card:BackBlue1')
            self.a_choise.position = self.size / 2
            self.add_child(self.a_choise)
            
        def update(self):
            pass
    
        def touch_began(self, touch):
            self.dismiss_modal_scene()
            #self.present_modal_scene(b_scene)
            
        def touch_moved(self, touch):
            pass
            
        def touch_ended(self, touch):
            pass
    
    
    class BScene (Scene):
        def setup(self):
            # add background color
            self.background = SpriteNode(color = 'white')
            self.background.size = self.size
            self.background.position = self.size / 2
            self.add_child(self.background)
            
            self.ship = SpriteNode('card:BackGreen1')
            self.ship.position = self.size / 2
            self.add_child(self.ship)
            
        def update(self):
            pass
    
        def touch_began(self, touch):
            self.dismiss_modal_scene()
            #self.present_modal_scene(c_scene)
            
        def touch_moved(self, touch):
            pass
            
        def touch_ended(self, touch):
            pass
    
    
    class CScene (Scene):
        def setup(self):
            # add background color
            self.background = SpriteNode(color = 'white')
            self.background.size = self.size
            self.background.position = self.size / 2
            self.add_child(self.background)
            
            self.ship = SpriteNode('card:BackRed1')
            self.ship.position = self.size / 2
            self.add_child(self.ship)
            
        def update(self):
            pass
    
        def touch_began(self, touch):
            self.dismiss_modal_scene()
            #self.present_modal_scene(second_scene)
            
        def touch_moved(self, touch):
            pass
            
        def touch_ended(self, touch):
            pass
    
    
    first_scene = FirstScene()
    second_scene = SecondScene()
    main_menu_scene = MainMenuScene()
    a_scene = AScene()
    b_scene = BScene()
    c_scene = CScene()
    # Instead of...
    # run(MyScene())
    
    # ..use:
    main_view = ui.View()
    scene_view = SceneView(frame=main_view.bounds, flex='WH')
    main_view.add_subview(scene_view)
    scene_view.scene = first_scene
    main_view.present(hide_title_bar=True, animated=False)
    

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!