首 页 | 新 闻 | Symbian | Android| Windows Mobile | J2ME | 下载中心 | 游戏策划招聘与求职 | 购书指南 | 视频教程
您现在的位置: 开发视界 >> Symbian >> 网络 >> 正文
S60 Python 编程指南——发送短信给多个手机
作者:佚名    文章来源:本站原创    更新时间:2006-12-19 11:10:34
*按以下要求编写一个程序:
1、在屏幕上显示以下字符: Type a word:


2、显示一个请求框:”Send message to your 2 friends ? “


3、当按 “ok” 后,程序发送短信到另外两个手机,要求输入内容: Greetings from: 输入字符


4、显示一个弹出通知: Messages sent

示例代码:
-----------------------------------------------
# Copyright (c) 2005 Jurgen Scheible
# this script lets you send an sms to 2 users at the same time

import appuifw
import messaging

data = appuifw.query(u"Type your name:", "text")

nbr1 = "123456" # change the mobile number here
nbr2 = "234567" # change the mobile number here
txt = u"Greetings from:" +data

if appuifw.query(u"Send message to your 2 friends","query") == True:
    messaging.sms_send(nbr1, txt)
    messaging.sms_send(nbr2, txt)

    appuifw.note(u"Messages sent", "info")
else:
    appuifw.note(u"Well, your Messages are not sent then", "info")
----------------------------------------------------
代码说明:
----------------------------------------------------
# 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")
相关文章:
S60 Python 编程指南——程序菜单练习(2)
S60 Python 编程指南——弹出菜单和选择列表
S60 Python 编程指南——弹出列表
S60 Python 编程指南——对话框和通知信息
S60 Python 编程指南——文本输入练习(一)
symbain OS编码特定规则
Symbian编程:俄罗斯方块六步曲 (第四步)
隐去等待对话框中的齿轮图标
 

站点地图 | 加入收藏 | 联系站长 | 广告服务 |
QQ:280529124  Tel:0592-8271361 辽ICP备05021703号