• ruimac

    I downloaded the PythonistaProjectTemplate to compile my scripts into fully working standalone apps.
    But the resulting app is huge!! Almost 90Mb.
    I opened the package and I noticed that there is a lot included that is NEVER used in my app. For example, the Textures folder contains 3444 images and I don't use a single one of them.
    Is it possible to streamline the compiled app? May I delete stuff.
    And is there any way to NOT include all this stuff when compiling in Xcode so that I don't have to, manually, delete everything after?

    posted in Pythonista read more
  • ruimac

    I'm trying to show an alert with console.alert
    But I keep getting an error saying: AssertionError: Cannot show alert from main UI thread
    So, can't I show an alert anywhere I need to?
    How can I show alerts?

    posted in Pythonista read more
  • ruimac

    Well, I create a view and I want to keep it visible all the time.
    I will see if I can restructure my code taking you example into account.
    Thank you very much :-)

    posted in Pythonista read more
  • ruimac

    Oh, the display_grid function updated some TextField items in my view, but not the ones whose field_edit function is attached to.

    posted in Pythonista read more
  • ruimac

    Well, here is a snippet of the function that calls the alert:

    def field_edit(sender):
        global current_player
        global lines
        global rows
        global scores
        global totals
        global finished
        global n_players
        global scores_grid
        global combs
        global info
    
        size=lines*rows
        start=current_player*size
        
        display_grid()
        
        for x in range(lines):
            
            last=-1
            for y in range(rows-1,-1,-1):
                value1=scores[start+(x*rows)+y]
                if value1!=0:
                    last=y
                    break
            
            if last!=-1:
                for y in range(last,-1,-1):
                    value1=scores[start+(x*rows)+y]
                    if value1==0:
                        alert('Esse valor não pode ser colocado nessa posição.')
                        return
    
    

    This function is assigned to a few TextField items so that, whenever I type something in there and press Enter, the function is executed.

    In the main function, a new View is created and the TextField items reside in that View.
    My main function ends with a my_view.wait_modal() so that the view doesn't close (if this is important).

    posted in Pythonista read more
  • ruimac

    I have no other console access.
    However, the alert function is being called from inside an action assigned to a TextField.

    posted in Pythonista read more
  • ruimac

    Is there any particular place where I should place that function for it to work?
    I still find it confusing why can't we simply show an alert wherever and whenever we want?

    posted in Pythonista read more
  • ruimac

    My function is like this:

    @ui.in_background
    def alert(message):
        alert_result=console.alert('Warning',message, button1='OK')
        return
    

    And I call it like this:

    alert('The message to show in the alert')
    

    posted in Pythonista read more
  • ruimac

    Well, I did that and the alert only shows when I close my View (in the top left X icon).

    posted in Pythonista read more
  • ruimac

    So, anyone know of a way?

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!