You Are Here:

Community: Developer Discussion Boards

#1 Old Confirmation of Exit Key - 2009-01-27, 02:44

Join Date: Dec 2008
Posts: 12
sonictail
Offline
Registered User
Hi Guys,

I'm trying to write a couple of simple bits of code, but it's not clicking. Trying to set it up so that when you hit the exit key, the program asks you for confirmation before quitting, and if you select no, it drops back to the program. However the exit key doesn't seem to want this. What am I doing wrong?

Code:
import appuifw, e32

def quit_game():
    appuifw.note(u"You Exit")
    app_lock.signal()

def return_game():
    appuifw.note(u"Return to game")

appuifw.app.exit_key_handler = appuifw.app.menu = [(u"Yes", quit_game), (u"No", return_game)]
app_lock = e32.Ao_lock()
app_lock.wait()
Reply With Quote

#2 Old Re: Confirmation of Exit Key - 2009-01-27, 03:19

Join Date: Nov 2007
Posts: 319
Location: Sertaozinho/Brazil
Send a message via MSN to marcelobarrosalmeida Send a message via Skype™ to marcelobarrosalmeida
marcelobarrosalmeida's Avatar
marcelobarrosalmeida
Offline
Forum Nokia Champion
Quote:
Originally Posted by sonictail View Post
Hi Guys,

I'm trying to write a couple of simple bits of code, but it's not clicking. Trying to set it up so that when you hit the exit key, the program asks you for confirmation before quitting, and if you select no, it drops back to the program. However the exit key doesn't seem to want this. What am I doing wrong?
sonictail,

appuifw.app.exit_key_handler expects a function, not a list.

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

#3 Old Re: Confirmation of Exit Key - 2009-01-27, 04:40

Join Date: Dec 2008
Posts: 12
sonictail
Offline
Registered User
Gah!

Well I went and modified the code for a function! And no luck, it just quits straight up

Code:
def confirm_quit():
    appuifw.app.menu = [(u"Yes", quit_game), (u"No", return_game)]

def quit_game():
    appuifw.note(u"You Exit")
    app_lock.signal()

def return_game():
    appuifw.note(u"Return to game")

print (u"Running Exit Menu")
appuifw.app.exit_key_handler = confirm_quit()
app_lock = e32.Ao_lock()
app_lock.wait()
Reply With Quote

#4 Old Re: Confirmation of Exit Key - 2009-01-27, 04:50

Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Send a message via Skype™ to Rafael T.
Rafael T.'s Avatar
Rafael T.
Offline
Forum Nokia Champion
Hi sonictail,


Easy thing to do

Try this:

Code:
import appuifw

def quit_game():
    c = appuifw.query(u"Do you really want to quit?", "query")
    if c:
        appuifw.note(u"You Exit")
        app_lock.signal()
    else:
        appuifw.note(u"Return to game")
        pass

appuifw.app.exit_key_handler = quit_game
app_lock = e32.Ao_lock()
app_lock.wait()

Hope it helps,

Rafael.
Reply With Quote

#5 Old Re: Confirmation of Exit Key - 2009-01-27, 06:31

Join Date: Dec 2008
Posts: 12
sonictail
Offline
Registered User
Thanks! That worked a treat
I'm having a lot of problems with designing simplified code, it's causing me massive issues I really appreciate the assist.
Reply With Quote

#6 Old Re: Confirmation of Exit Key - 2009-01-27, 08:04

Join Date: Feb 2008
Posts: 2,543
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 sonictail View Post
Thanks! That worked a treat
I'm having a lot of problems with designing simplified code, it's causing me massive issues I really appreciate the assist.
hello sonictail

you are always welcome in this wonderful forum to ask for any sort of assistance you require.
Moreover if you are a newbie do have a look at my tutorials.

Enjoy Pythoning
Gaba88


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

Forum Nokia Python Wiki


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

#7 Old Re: Confirmation of Exit Key - 2009-01-27, 12:38

Join Date: Nov 2007
Posts: 319
Location: Sertaozinho/Brazil
Send a message via MSN to marcelobarrosalmeida Send a message via Skype™ to marcelobarrosalmeida
marcelobarrosalmeida's Avatar
marcelobarrosalmeida
Offline
Forum Nokia Champion
Quote:
Originally Posted by sonictail View Post
Thanks! That worked a treat
I'm having a lot of problems with designing simplified code, it's causing me massive issues I really appreciate the assist.
Sorry, sonictail, I just answered a quick and short response imagining you was only with some of that distractions that happens to us frequently. Fortunately, we have a lot of generous persons at this dibo ! ;-)


Marcelo Barros
Nokia E71, N800, N95 and XM 5800
http://www.croozeus.com
http://wordmobi.wordpress.com
http://jedizone.wordpress.com
Reply With Quote

#8 Old Re: Confirmation of Exit Key - 2009-01-29, 11:38

Join Date: Dec 2008
Posts: 12
sonictail
Offline
Registered User
Quote:
Originally Posted by gaba88 View Post
hello sonictail

you are always welcome in this wonderful forum to ask for any sort of assistance you require.
Moreover if you are a newbie do have a look at my tutorials.

Enjoy Pythoning
Gaba88
Dude, never apologise for helping a man out! "I'm not sorry that I helped you, I'm just sorry that I didn't help you enough" Seriously, it did help as it appears to have been the final piece everything clicking, I can write python now!

Quote:
Originally Posted by gaba88 View Post
hello sonictail

you are always welcome in this wonderful forum to ask for any sort of assistance you require.
Moreover if you are a newbie do have a look at my tutorials.

Enjoy Pythoning
Gaba88
Thanks! Already been through your site, but it's apparently also listed as being a virus risk by chrome and google. Has the site been compromised?
Reply With Quote

#9 Old Re: Confirmation of Exit Key - 2009-01-29, 15:04

Join Date: Jul 2008
Posts: 103
ck.umraliya's Avatar
ck.umraliya
Offline
Forum Nokia Champion
Quote:
Originally Posted by sonictail View Post
Thanks! Already been through your site, but it's apparently also listed as being a virus risk by chrome and google. Has the site been compromised?
This is a temporary issue. We'll solve this soon.
We have made the site available at http://pys60.uuuq.com
Alternatively you can also have a look at http://ck.umraliya.googlepages.com

Regards,
Reply With Quote

#10 Old Re: Confirmation of Exit Key - 2009-01-29, 15:11

Join Date: Feb 2008
Posts: 2,543
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 sonictail View Post
Thanks! Already been through your site, but it's apparently also listed as being a virus risk by chrome and google. Has the site been compromised?
Hello Sonictail

i guess the problem is solved now and the website is working fine. Are you still getting that sort of notification in chrome??

Enjoy Pythoning
Gaba88


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

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
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
Exit key does not work for standalone app. richard_a Python 6 2008-07-16 06:34
right soft key to exit on full-screen canvas Larry101 Mobile Java General 5 2008-02-21 12:44
why my does not exit on N73 when i push exit soft key? byronlilu Mobile Java General 2 2007-06-28 22:29
N70 Reset bug sebboB General Discussion 2 2005-12-29 00:09
UNDESIRED Exit command key. tektronic Mobile Java General 4 2005-05-13 19:27

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