太极匀手,马步必备,太极匀马步必备,[Python]代码#!
太极匀手,马步必备,太极匀马步必备,[Python]代码#!
[Python]代码
#! /usr/bin/env python#coding=utf-8import datetime,threadingimport appuifw, e32, thread,audioitems = [u"太极",u"马步"]#第一次开始锻炼的时长以及每天增加的时间#时长均为一组内时间,每天选择做多组horse_time_init = 60horse_time_add = 5horse_time_today = 60taiji_time_init = 60*8taiji_time_add = 30taiji_time_today = 60*8#锻炼起始日期begin_date = datetime.date(2012, 6, 8)#锻炼时间达到提醒信息内容message = "时间到"#时间间隔提醒,默认每30s提醒一次notice_space = 30#提醒信息内容message_notice = "滴滴"title = ""last_time = u""content = ""app_lock=e32.Ao_lock()#计算今天每组需要锻炼的时间def init(): now = datetime.date.today() days = (now - begin_date).days horse_time_today = horse_time_init + horse_time_add*days taiji_time_today = taiji_time_init + taiji_time_add*days#计时器 def SportsTime(sports_event_time): while sports_event_time > notice_space:#每隔notice_space时间通知一次 sports_event_time -= notice_space threading._sleep(notice_space) audio.say(message_notice) while sports_event_time >= 1: flag = sports_event_time%2#除以2会导致数据变小,flag用作修正标识 sports_event_time /= 2 if flag: sleep_time = sports_event_time + 1 else: sleep_time = sports_event_time threading._sleep(sleep_time) audio.say(message_notice) audio.say(message)def main(): init() appuifw.title = "" index = appuifw.popup_menu(items,u"锻炼哪一个?") if index == 0: Sports = taiji_time_today else: Sports = horse_time_today t = thread.start_new_thread(SportsTime, (Sports,))def quit(): if appuifw.query(u"确认退出?",'query'): app_lock.signal()def about(): appuifw.note(u"计时器 V0.1",'info')if __name__ == "__main__": appuifw.app.title=unicode("计时器","utf8") appuifw.app.screen='normal' appuifw.app.menu=[(unicode("关于","utf8"),about),(unicode("退出","utf8"),quit)] appuifw.app.exit_key_handler=quit content = appuifw.Text() content.set(u"write by gongsh.wait for next version~") appuifw.app.body=content main() app_lock.wait()
相关内容
- python调用win32应用程序,python调用win32,[Python]代码fr
- 斐波那契数,,[Python]代码#-
- 将List转成XML,List转成XML,[Python]代码#
- 在pymongo中使用sql的like语句,pymongolike,db.houses.fi
- python 解决0-1背包问题算法,python0-1背包算法,#!/usr/bin
- python执行外部程序的四种方法汇总,python四种方法,1、
- python 冒泡,python,[Python]代码#-
- 别再老上网了,上网,[Python]代码#-
- makeNumPwd,,[Python]代码de
- 根据规则生成随机密码,规则生成随机密码,[Python]代码
评论关闭