×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    72

    Displaying Dynamically

    Hi python experts,

    I have used the following piece of code:
    Code:
    import appuifw,e32
    
    app_lock = e32.Ao_lock()
    
    def quit():
        app_lock.signal()
    appuifw.exit_key_handler = quit
    
    f = open(u"c:\\loc_details.txt","rb")
    p = f.readlines()
    
    for x in p:
        x = x.replace('\r\n','')
        y = x.split(',')        
        fields = [(u'Location','text',u''+y[0]),
                  (u'Latitude','text',u''+y[1]),
                  (u'Longitude','text',u''+y[2])]
        flags = appuifw.FFormViewModeOnly
            
        f = appuifw.Form(fields,flags)
        f.execute()
        e32.ao_sleep(1)
    
    app_lock.wait()
    And my loc_details.txt have some text like this:
    Code:
    House,12.924198,77.621949
    Office,12.8381576,77.6571918
    My query is: I have to display the location details dynamically... But my code displays the next location detail from the text file only after me clicking "Back" key.. I want it to display each location detail automatically say after 2 secs...

    How to get this done......
    Thanks in advance for ur quick responses

  2. #2
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,795

    Re: Displaying Dynamically

    Quote Originally Posted by v divya View Post

    I want it to display each location detail automatically say after 2 secs...
    Sorry, but your code is not meant to do this.

    I cannot see a timer of 2 seconds which calls a function implemented anywhere in the code. Nor can I see a loop?
    Pankaj Nathani
    www.croozeus.com

  3. #3
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    72

    Re: Displaying Dynamically

    Quote Originally Posted by croozeus View Post
    Sorry, but your code is not meant to do this.

    I cannot see a timer of 2 seconds which calls a function implemented anywhere in the code. Nor can I see a loop?
    Can u be more clear... I have used e32.sleep(2)... How to make change in that given code...

    I dont know how to change it.. I tried but ended in vain...

    So someone pls do provide a more clear idea....

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Displaying Dynamically

    Quote Originally Posted by v divya View Post
    Can u be more clear... I have used e32.sleep(2)... How to make change in that given code...

    I dont know how to change it.. I tried but ended in vain...

    So someone pls do provide a more clear idea....
    hello divya

    what you should do is open the file, read its content and display the contents on the screen using a canvas or anything else.

    Now for making it dynamic you can use the timers which will implement above algorithm for every particular interval.

    For timers you can search the wiki.

    Cheers,
    Gaba88

  5. #5
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    72

    Re: Displaying Dynamically

    Thanks gaba........ I tried using timer.. But still not working properly... Can someone fix this and help me resolve it...

    It is very urgent.........

    Code:
    import appuifw,e32
    
    timer = e32.Ao_timer()
    delay = 1
    app_lock = e32.Ao_lock()
    
    def quit():
        app_lock.signal()
    appuifw.exit_key_handler = quit
    
    f = open(u"c:\\loc_details.txt","rb")
    p = f.readlines()
    
    def do_this():
        fields = [(u'Location','text',u''+y[0]),
                  (u'Latitude','text',u''+y[1]),
                  (u'Longitude','text',u''+y[2])]
        flags = appuifw.FFormViewModeOnly
            
        f = appuifw.Form(fields,flags)
        f.execute()
        
    for x in p:
        x = x.replace('\r\n','')
        y = x.split(',')
        timer.after(delay,do_this)
    
    app_lock.wait()
    Where is it I have gone wrong..

  6. #6
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: Displaying Dynamically

    HI v divya

    I have a code for this in my home but only tonight I can send it to you (I am work).
    I used a listbox instead. For avoiding flickering, before doing a new set_list() I saved the last selected item so set_list(items,last_selected) will make this flickering less noticeable.

    Marcelo

Similar Threads

  1. dialog creation dynamically
    By mallikachand in forum Symbian User Interface
    Replies: 1
    Last Post: 2008-05-15, 12:03
  2. Error in displaying calender in nokia N73
    By abbaraju in forum Mobile Java Tools & SDKs
    Replies: 3
    Last Post: 2008-03-13, 18:14
  3. Displaying file names dynamically
    By jobin.tech in forum Symbian
    Replies: 9
    Last Post: 2007-07-17, 09:31
  4. Dynamically Adding Controls
    By Sohil in forum Symbian
    Replies: 6
    Last Post: 2007-02-20, 14:09
  5. Fast Displaying Bitmap
    By yfho in forum Symbian
    Replies: 2
    Last Post: 2003-09-26, 16:39

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×