• NoneNone94

    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?

    thnx

    posted in Pythonista read more
  • NoneNone94

    Hi

    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:

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

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

    Thank you

    posted in Pythonista read more
  • NoneNone94

    Can I have keyboard input while a scene is running? Would the keyboard pop up when a scene is running?

    posted in Pythonista read more
  • NoneNone94

    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

    posted in Pythonista read more
  • NoneNone94

    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.

    posted in Pythonista read more
  • NoneNone94

    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?

    posted in Pythonista read more
  • NoneNone94

    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))
    p=scene.render_text(SomeStringList[x],font,size)
    S[x]=p[0]
    del p

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

    Thnx again

    posted in Pythonista read more
  • NoneNone94

    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.

    posted in Pythonista read more
  • NoneNone94

    Dear OMZ

    do you think we will have a keyboard module in the next update?

    posted in Pythonista read more
  • NoneNone94

    Dear all

    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?

    posted in Pythonista read more
  • NoneNone94

    A good idea would be to have a Keyboard() module (like touch() module) which is assigned to a scene and returns each key which is hit on the keyboard.

    As i remember in one of the posts, OMZ described pyhtonista vs codea, as pythonista to be more for building "tools" rather than "games" in Lua. I agree and thatis why I guess keyboard input is crucial since I guess it is much widely used in tools rather than games.

    posted in Pythonista read more
  • NoneNone94

    Thnx silverkors. I will use the code. But i think the app must really have a Keyboard input function for the scenes. It is crucial.

    I guess it is a good idea to built a thread for all the Feature Requests. Isn't it?

    posted in Pythonista read more
  • NoneNone94

    hi

    i was trying to blend a text with an image and use it as an image of a layer. i opened the background image, wrote a text on it using ImageDraw.text and loaded it as layer's image with load_pil_image.

    but it seems that quality of the text is poorer that a text directly drawn on the scene using scene.text.

    1- is there a solution for that?

    2- while i was searching for a solution i found the TextLayer command in the Cascade example, for which no documentation seems to be available. can i use this to solve my problem?

    thnx

    posted in Pythonista read more
  • NoneNone94

    Hi

    When I try to import xml.parsers.expat, it gives me the following error. (also when I want to read a plist). Can you show an expample of reading a plist data file?

    import xml.parsers.expat
    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/var/mobile/Applications/7FEFDAEF-0307-4187-92A2-C5B6C77BF2B5/Pythonista.app/pylib/xml/parsers/expat.py", line 4, in <module>
    from pyexpat import *
    ImportError: No module named pyexpat

    posted in Pythonista read more
  • NoneNone94

    thanks pudquick,OMZ

    actually i converted my plist to JSON and imported it into my iDevice. it works pretty well.

    thanks

    posted in Pythonista read more
  • NoneNone94

    Dear OMZ

    First: sorry for posting so much. I really enjoy yor app and want it to work better.

    After: while I was playing with the embedded template for Scene With Layers, I encountered something: I replaced the layer's image with another one and also added the same image to Draw() to be drawn directly on the scene.

    When I started the scene, the image directly drawn on the scene was ok but the same image drawn on the layer was blur. The interesting point was that while you touched the screen and layer moved, every thing became ok. And also I figured out that it was a problem just with certain images!

    You can download the script and the image form:
    http://db.tt/gWhIjGLb
    (add image as _Image_11)

    posted in Pythonista read more
  • NoneNone94

    hi

    a question: i can easily read mu plist using plistlib of python on my PC. it is a huge plist containing about 118000 entries and their definitions.

    i am new to python. is there a solution (a routine) by which i can read the plist on PC and write it as an easily-read-by-python format?

    it doesnt't matter if it takes time (30 mins for example) because after that i have a file which can be easily used iny pythonista.

    thnx

    posted in Pythonista read more
  • NoneNone94

    Thanks michael, but actually I just was using plistlib.readPlist (from your link) when I encountered that error. I guess it is because, from description of plistlib.readPlist in your link, "XML data is parsed using the Expat parser from xml.parsers.expat" when you use plistlib.readPlist.

    Thanks anyway.

    posted in Pythonista read more
  • NoneNone94

    No. I don't want to use binary plists. I Actually I had re-formatted a free English-English dictionary with about 118000 entires to Plist format ('<'key> word '<'key> '<'string>definition'<'string>) and was using it in an app I wrote in Codea. I was going to reconstruct that app in Pythonista too because Pythonista allows me to use my app on my iPod touch too.

    So you say for the time being I can not use readPlist function, yes?

    If so I will wait for the update.

    And after all questions I have to thank you for your great app and patience you have with newbies like me.

    posted in Pythonista read more
  • NoneNone94

    thank you so much. i will check that example and i guess it would be fine.

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!