You Are Here:

Community: Developer Discussion Boards

#1 Old Displaying Dynamically - 2009-04-29, 08:24

Join Date: Feb 2009
Posts: 72
v divya
Offline
Regular Contributor
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
Reply With Quote

#2 Old Re: Displaying Dynamically - 2009-04-29, 09:34

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Online
Forum Nokia Champion
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?
Reply With Quote

#3 Old Re: Displaying Dynamically - 2009-04-29, 12:12

Join Date: Feb 2009
Posts: 72
v divya
Offline
Regular Contributor
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....
Reply With Quote

#4 Old Re: Displaying Dynamically - 2009-04-29, 20:31

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Online
Forum Nokia Champion
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


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#5 Old Re: Displaying Dynamically - 2009-04-30, 10:46

Join Date: Feb 2009
Posts: 72
v divya
Offline
Regular Contributor
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..
Reply With Quote

#6 Old Re: Displaying Dynamically - 2009-04-30, 13:36

Join Date: Nov 2007
Posts: 317
Location: Sertaozinho/Brazil
Send a message via MSN to marcelobarrosalmeida Send a message via Skype™ to marcelobarrosalmeida
marcelobarrosalmeida's Avatar
marcelobarrosalmeida
Online
Forum Nokia Champion
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


Marcelo Barros
Nokia E71, N800, N95 and XM 5800
http://www.croozeus.com
http://wordmobi.wordpress.com
http://jedizone.wordpress.com
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
dialog creation dynamically mallikachand Symbian User Interface 1 2008-05-15 13:03
Error in displaying calender in nokia N73 abbaraju Mobile Java Tools & SDKs 3 2008-03-13 19:14
Displaying file names dynamically jobin.tech General Symbian C++ 9 2007-07-17 10:31
Dynamically Adding Controls Sohil General Symbian C++ 6 2007-02-20 15:09
Fast Displaying Bitmap yfho General Symbian C++ 2 2003-09-26 17:39

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia