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?
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.
Posts made by ruimac
-
Huge standalone
-
Can't show an alert?
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? -
RE: Can't show an alert?
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 :-) -
RE: Can't show an alert?
Oh, the
display_grid
function updated some TextField items in my view, but not the ones whosefield_edit
function is attached to. -
RE: Can't show an alert?
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.
Mymain
function ends with amy_view.wait_modal()
so that the view doesn't close (if this is important). -
RE: Can't show an alert?
I have no other console access.
However, the alert function is being called from inside an action assigned to a TextField. -
RE: Can't show an alert?
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? -
RE: Can't show an alert?
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')
-
RE: Can't show an alert?
Well, I did that and the alert only shows when I close my View (in the top left X icon).
-
RE: Any way to test out compiled scripts in physical iPad without a developer account?
So, anyone know of a way?
-
Any way to test out compiled scripts in physical iPad without a developer account?
I'm loving Pythonista. It is exactly what I would consider a nice way to develop some simple apps.
But when I tried to compile it in Xcode and tried to run it, since I still don't have a developer account, I can only try it in the virtual simulator.
In there, some stuff did not showed up exactly as it shows when I run the script in Pythonista.
For example, then I set the size of the font for a TextView item with my_item.font('fontname',38), the font, once compiled, doesn't appear in size 38 (it appears smaller).
Since I don't know if this is a problem of the virtual simulator, I would like to try it running in the iPad itself.
But I'm not willing to invest in a full year developer fee if it proves to be a problem that also happens in the real-life environment (I'm not a full time programmer. I'm just a freelance designer that likes to code).
Is there any way for me to install a compiled app in my iPad to test it in real-world conditions? -
Adding snippets. Possible? How to?
When I type sep and press Enter, I get a line like this:
// ****************************************
However, the comments in python start with #, so I have to edit the line to change it to
*****************************************
How can I save new snippets in order to speed up my typing? Is it possible at all?
-
Find & Replace instead of just Find
Are there any plans for a Find & Replace option instead of just being able to perform a Find?
-
RE: Find & Replace instead of just Find
Well, if it does add the ability to perform search & replace, yes, it is what I'm looking for :-)
But, if it was a native feature of Pythonista it would be great for everyone, wouldn't it?
-
RE: Huge standalone
Thank you so much :-)
Is it better to delete those from the project folder to start with or delete them from the package once it is created? -
RE: Any way to test out compiled scripts in physical iPad without a developer account?
Thank you for the answers.
In fact I was not using a system font. I was using a font that I had added with AnyFont.
Using a system font (I tried with Gill-Sans) it previewed fine in the simulator.
However, I would also like to test out how my apps behave with a bluetooth keyboard and I can't because whenever I click in a TextField, the soft-keyboard shows up. As soon as I retract it, the TextField becomes inactive.
So, the only way to really test real-world scenarios is running the app in the physical iPad.
I really don't want to jailbreak it (required, for the method that the tutorial shows).
I already found a way to create an .ipa file but when I try to install it in my iPad through iTunes, to test it out, it appears darkened and, when I click it in my iPad, it show "Installing..." and never really executes. -
RE: Getting the current View
Thank you for the information.
I guess I will go the global way too. -
Getting the current View
I created a new View where I'm presenting several items (TextViews, Buttons, etc)
I also created a routine for checking the values of some TextFields, that I attached to the action parameter of those text fields.
The routine is called field_edit and its only parameter is (sender).
However I would like to be able to create some new items in the view, inside that routine.
How can I access the View, since the variable used to create it is in the main routine?
Must I make it global? Or is any way to access the current view? -
RE: Access the Console while script is running
Oh, great!!! I didn't knew that one.
Well, I only have Pythonista for three days now (and I already coded a large script).
I just have to learn some more.
Thank you :-)Mental note: Use 'panel' while developing and then replace with 'full_screen'. Better yet, make it a global variable and just change it as it is needed :-)
-
Access the Console while script is running
Is there any way to access the Console while the script is running?
I usually print stuff to the console while debugging or checking for logical errors.
But it is a pain having to stop the script to check out the console output.