1. Python para s60 1 Python para S60 ( PyS60 ) 2 Instalación de PyS60 en el teléfono 3 Desarrollo de aplicaciones usando Microsoft Windows 4 Desarrollo de aplicaciones usando GNU/Linux 5 Ejemplos de prueba
14. Hola Mundo ! <FONT SIZE=2>import appuifw appuifw.note(u"Hellow World!", "info") """ NOTA: Las cadenas de texto deben de ser definidas como unicode. u"..." El mobil no puede desplegar los textos apropiadamente de otra manera. """ </FONT> Pagina principal Regresar
15. Envío de SMS <FONT SIZE=2>""" Copyright (c) 2005 Jurgen Scheible this script lets you send an sms to 2 users at the same time. """ """ import the messaging module ""“ import appuifw import messaging """ create text input field """ data = appuifw.query(u"Type your name:", "text") """ define the mobile numbers here""" nbr1 = "123456" nbr2 = "234567" """ define the text that the sms shall contain ""“ txt = u"Greetings from:" +data """ create a query with type: "query" -> appuifw.query(label, type) by using an if statement one can check whether the user has pressed "ok" -> True or "cancel" -> False ""“ if appuifw.query(u"Send message to your 2 friends","query") == True: """ send out the sms; include the mobile number and the text to be sent ""“ messaging.sms_send(nbr1, txt) messaging.sms_send(nbr2, txt) """ confirm with a pop-up note that the sms has been sent out """ appuifw.note(u"Messages sent", "info") else: """ in case the user had pressed "cancel", send a pop-up note that the messages have not been sent out """ appuifw.note(u"Well, your Messages are not sent then", "info") </FONT> Pagina principal Regresar
16. Recepción de SMS <FONT SIZE=2>""“ Copyright (c) 2006 Jurgen Scheible This script waits for an incoming sms, reads its content and shows it inside a pop-up note NOTE: PyS60 version 1.3.1 or higher is needed to run this script. """ """ import the module inbox (that handles incoming sms things) """ import inbox import e32 """ create a function that does the content sms reading """ def read_sms(id): e32.ao_sleep(0.1) """ create once more an instance of the inbox() class ""“ i=inbox.Inbox() """ read the content out of the message that has just arrived ""“ sms_text = i.content(id) """ display the content inside a pop-up note ""“ appuifw.note(u"sms content: " + sms_text , "info“) """ create an instance of the inbox() class """ i=inbox.Inbox() print "send now sms to this phone“ """ put the phone into waiting stage to wait for an incoming message ""“ i.bind(read_sms) </FONT> Pagina principal Regresar
18. Uso de FTP <FONT SIZE=2> """ Copyright (c) 2006 Jurgen Scheible this script lets you upload a file to a URL using the FTP protocol NOTE: you need to install first the ftplib library to your phone before you can use ftp, because the Nokia Python for S60 package does not incude it by default. NOTE: You need to install the ftplib.py file on your phone as a python library (not a python script). The ftplib.py (comes originally with the desktop python version) ""“ """ in order to get this script work, you need to fill in: - your servername (your server must be capable of using FTP) - username and password - the correct folder where to store the file ""“ import appuifw from ftplib import FTP """ name of file to be uploaded (path on phones hard drive)""“ picselection = "c:/testimg.gif“ def fireupfile(): global picselection ftp = FTP('www.exampleserver.com') """ give servername""“ ftp.set_pasv('true') ftp.login('username','password') """ give login anonymous""" """ give correct folder where to store the image """ ftp.cwd('public_html/examplefolder') F=open(picselection,'r') """ give name of image to be stored as URL ""“ ftp.storbinary("STOR image.gif",F,1024) ftp.quit() F.close() if appuifw.query(u"fire up image?","query") == True: fireupfile() </FONT> Pagina principal Regresar
19. Envío de MMS <FONT SIZE=2>""" Copyright (c) 2007 Jurgen Scheible this script lets you send an mms to another phone including text and an image """ import appuifw import messaging """ create text input field ""“ data = appuifw.query(u"Type your name:", "text") """ define the mobile number here where to send the MMS """ nbr = "123456" """ change the mobile number here ""“ """ define the text that the sms shall contain ""“ txt = u"Greetings from:" +data """ image attachment: You must have an picture already available with the name picture1.jpg inside the folder called Images on your memory card. ('e:Imagespicture1.jpg') otherwise the script won't work. (use video or sound file instead of image) send out the mms; include the mobile number, the text and the attachement to be sent """ messaging.mms_send(nbr, txt, attachment='e:Imagespicture1.jpg') """ confirm with a pop-up note that the sms has been sent out ""“ appuifw.note(u"MMS sent", "info") </FONT> Pagina principal Regresar