Thanks this is really helpful.
So with the yield command in your quoted code i can now push the exit button, but nothing happens.
Interestingly, when I insert another line of code in the quit function, the whole of pys60 exits when i push the exit button. It doesn't go back to script shell, it just exits altogether.
Code:
import appuifw, e32, audio
def quit():
audio.say("quit")
running = 0
appuifw.app.exit_key_handler = quit
y = 0
running = 1
while running:
logfile = open("e:\\Python\\batterylife.txt", "w")
print(y)
for x in range(10000):
x * x * x
logfile.write(str(y))
print >> logfile, '\r'
logfile.close()
y += 1
logfile2 = open("e:\\Python\\batterylife2.txt", "w")
print(y)
for x in range(10000):
x * x * x
logfile2.write(str(y))
print >> logfile2, '\r'
logfile2.close()
y += 1
e32.ao_yield()
Why should the addition of the audio.say("quit") command make the quit function work, whereas without that extra line the quit function didn't behave as it should do! hmmmm