搞了两天终于搞定了,虽然还存在一点点小问题(窗口的显示位置应该设在(0,0))。但基本可以用了。

代码分两个部分。主界面和遮挡屏幕界面。主界面设置完时间后调用遮挡屏幕界面。

1.主界面(设置 工作时间 和 休息时间(单位为:秒))

#-*-coding:utf--*-
import Tkinter,time,tkMessageBox,sys,BeBigModule
class MainFrame:
def __init__(self):
self.frame=Tkinter.Frame()
self.frame.pack() contentsWork=Tkinter.StringVar()
contentsRelax=Tkinter.StringVar() self.entryWorkWidget=Tkinter.Entry(self.frame,text=contentsWork)
contentsWork.set('input workTime here:')
self.entryWorkWidget["width"]= #这句话和下句话的先后顺序不会影响程序
self.entryWorkWidget.pack(side='top') self.entryRelaxWidget=Tkinter.Entry(self.frame,text=contentsRelax)
contentsRelax.set('input relaxTime here:')
self.entryRelaxWidget.config(width=)
self.entryRelaxWidget.pack(side='top') self.startButton=Tkinter.Button(self.frame,text="OK",command=self.start)
self.startButton.pack(side='left') self.quitButton=Tkinter.Button(self.frame,text="Exit",command=self.quit)
self.quitButton.pack(side='right')
self.frame.mainloop()
def start(self):
workTime=self.entryWorkWidget.get().strip()
workTimeNum=int(workTime)
# self.frame.deiconify()
# self.frame.withdraw
relaxTime=self.entryRelaxWidget.get().strip()
relaxTimeNum=int(relaxTime) self.frame.destroy()
beBigFrame=BeBigModule.BeBig(workTimeNum,relaxTimeNum) def quit(self):
pass
# root=Tkinter.Tk()
# root.title("CountDowm")
#
# mainFrame=MainFrame(root)
# root.mainloop()
mainFrame=MainFrame()
#目前来看就剩个问题了,怎么设定窗口的显示位置

2.遮挡屏幕界面

import Tkinter,sys,time
class BeBig():
workTime=
relaxTime=
root=Tkinter.Tk()
Label1=Tkinter.Label(root,text=time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))
def __init__(self,workTimeNum,relaxTimeNum):
self.workTime=workTimeNum
self.relaxTime=relaxTimeNum
self.root.minsize(self.root.winfo_screenwidth(), self.root.winfo_screenheight())
#self.root.geometry('300x200-100-100')
self.root.config(bg='black') self.Label1.pack(side='top')
topTitle=self.root.winfo_toplevel()
topTitle.overrideredirect(True)
self.trickit(self.relaxTime,self.workTime)
self.root.mainloop()
def trickit(self,relaxTime,workTime):
for j in range(relaxTime,,-):
self.Label1["text"]=j
self.root.update()
time.sleep() self.root.withdraw()
time.sleep(workTime)
self.root.minsize(self.root.winfo_screenwidth(), self.root.winfo_screenheight())
self.root.update()
self.root.deiconify()
self.trickit(self.relaxTime,self.workTime)
# beBig.beBig()

最新文章

  1. ACM HDU 2041--超级楼梯题解
  2. 强势回归,Linux blk用实力证明自己并不弱!
  3. python 协程
  4. Yii CModel中rules验证 获取错误信息
  5. StringBuffer and StringBuilder
  6. WebApi:路由和Action选择
  7. JSP页面编码问题
  8. 重定向 url cookie
  9. Strom Topology执行分析:worker数,Bolt实例数,executor数,task数
  10. Swift属性
  11. 自己动手Jquery插件
  12. php远程读取json的方法
  13. 7、第七节课,js逻辑运算
  14. copy算法
  15. MFC中菜单变灰的问题
  16. proc文件系统探索 之 根目录下的文件[二]
  17. php-beast 代码加密
  18. 安装mysql时出现应用程序无法正常启动(0xc000007b)
  19. ural1018依赖背包-边权
  20. MySQL Workbench在archlinux中出现 Could not store password: The name org.freedesktop.secrets was not provided by any .service files的错误

热门文章

  1. AIX用户管理
  2. Swift - iCloud存储介绍
  3. Python 学习入门(22)—— 线程同步
  4. Eclipse Maven 插件地址
  5. 延迟函数 比sleep效果好
  6. spring boot application properties配置详解
  7. Struts2图片文件上传,判断图片格式和图片大小
  8. IT忍者神龟之中的一个句sql语句——连接同一字段的全部值
  9. uva 10069 Distinct Subsequences(高精度 + DP求解子串个数)
  10. FOJ 2170 花生的序列 dp