I want to make a code which shows a text on the screen and highlights any word when you touch it. so i need a function which returns size of any word which is drawn on the screen. so far the most relevant thing i found was scene.render_text. but it gives you an image too.
i am afraid that while computing a 300 word text, it loads 300 images (which i do not use) to the memory and have negative effect on performance.
what do you think i can do?
I have been using Codea for a while. I have recently downloaded Pythonista and I am trying to work with it. But since I am familiar with Codea I have two questions:
- How in Pythonista can I change Scenes? You know, I want a Scene showing first and then I want another one showing after some operations.
In Codea we have the Main routine, and you can built your main operations in its Draw(), and refer to various scenes in that.
But in all Pythonista examples there was just one Scene and I couldn't find an equivalent for Draw() of the Main routine in Lua. This is a crucial feature. Because what I want is a root routine which includes some operations and calls various Scenes.
- in Codea there are Sprites and Meshs. As iPad process meshes much faster than sprites, people use meshes. Do we have these concepts in Pythonista?
It has to be told that I don't want to compare these two great apps, I am just familiar with Codea and I want to understand its equivalent features in Pythonista
thnx so much silverkors.
i now don't have access to my idevice. as far as i could check from the class it draws a keyboard using rect and text. it is cool.
actually i am working on a simpler keyboard (just lower-key letters, no numbers).
my approch has been to load the iPhone keyboard pic as png. and for every key you hit it shows a somehow big rectangle of the letter above the key (something like when you hit a key in native iPhone keyboard). so it needs just three layers (keyboard, rectangle image, textlayer of the key you hit).
i will upload it when ready
i just realized that probably i can use another approach without multiscenes. i can built draw1(),...,drawN() and call each of them i want in draw() of a single scene. i try to see what would happen this way.
...it seems to work. so i can now use multi pages. so i guess #1 is solved for me.
i tried to the scheme u propopsed with the "scene with layers" (Myscene) as the slave layer and a master scene (Myscene1).
unfortunately when i run Myscene1 it tells me, as the first error, that (Myscene object had no attribute "bounds"). so i guess when the slave scenes do have layers it is tricky. what do u suggest? defining all the slave scenes to work and modify just layers in the master scene?
Thank you. Actually i had seen the ImageDraw option but I preferred to stick to TextLayer. But I guess I have to know how images of scene.render_text are stored. As far as I realized they are not stored in the image directory so I guess they must be stored in the memory. If so if I do this:
For x in range(len(SomeStringList))
(storing just size and deleting the scene.render_text object) will it free the memory?
You know, actually I have the same question about remove_layer. Will remove_layer free the memory dedicated to removed layer? (because in my code I repeatedly remove and add the same layers)
ok. i understand. thank you. you have already done a great job. you know, i am exploring Pythonista and that's why i post so many questions (one will come in couple of minutes!) and feature requests. but i totally understand that wishing a feature is easy but making it may not be so easy!
as for keyboard, as you also suggested in another post, i use Pythonista for making tools rather than games and, you know, in these sort of apps keyboard input has a crucial role.
anyway, i will wait for the keyboard feature, while enjoying Pythonista.
PS: as i suggested in another post, i think it will be a good idea for the forum to have "Feature Requests" and "Issue Tracker" sections. i guess it will make your work in developing Pythonista easier.
I was going to post a thread regarding "Feature Requests" in which all of the requested features could be included by members. Just description of them and not any commenting or debate, etc. so that just with a glance one can understand what items are mostly required.
But I am just a newbie and I want to know ur ideas about it. Do you think it is a good idea?