Hi to all!
I wanna write a simple application that when i press any key, my phone vibrate.
I have read this article:
Code:
# import modules
import appuifw, e32, key_codes, miso
# define functions to show notifications
def up():
miso.vibrate(250,5)
def two():
miso.vibrate(250,5)
def quit():
app_lock.signal()
# Create Canvas object
canvas = appuifw.Canvas()
appuifw.app.body = canvas
# Bind keys
canvas.bind(key_codes.EKeyUpArrow, up)
canvas.bind(key_codes.EKey2, two)
# Exit handling
appuifw.app.exit_key_handler = quit
app_lock = e32.Ao_lock()
app_lock.wait()
and this article
Code:
import keycapture, key_codes, globalui, miso
#Define a method to be called when a key press event occurs
def cb_key_capture(key):
#TODO: Handle events here
#For example, tell the user what key was pressed
for i in dir(key_codes):
if key == eval("key_codes." + i):
miso.vibrate(250,5)
break
#Make the application close when the right softkey is pressed
if key == key_codes.EKeyRightSoftkey:
capturer.stop()
#Create a KeyCapturer object, specifying the method
capturer = keycapture.KeyCapturer(cb_key_capture)
#All keys should be captured
capturer.keys = keycapture.all_keys
#Alternatively, if only certain keys need to be handled, they can be specified as a tuple of keycodes
#Start detecting key presses
capturer.start()
and i have modify it but there is a problem.
the "keycapture mode" is on only when python app is on foreground (first script) or that the original key function are disabled (second script)
key anyone help me to create a simple application that vibrate my phone when i press any key???
thanks
Pagina 1 di 1
[aiuto] Vibra Quando Premo I Tasti...
- ← Python 1.97 Update Error
- python
- Consiglio Per Mostrare A Video Breve Testo Da Mysql O Pagina Web →
Condividi questa discussione:
Pagina 1 di 1

Aiuto













Pubblicità