搞了两天终于搞定了,虽然还存在一点点小问题(窗口的显示位置应该设在(0,0))。但基本可以用了。
代码分两个部分。主界面和遮挡屏幕界面。主界面设置完时间后调用遮挡屏幕界面。
1.主界面(设置 工作时间 和 休息时间(单位为:秒))
#-*-coding:utf-8-*- 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"]=35 #这句话和下句话的先后顺序不会影响程序 self.entryWorkWidget.pack(side='top') self.entryRelaxWidget=Tkinter.Entry(self.frame,text=contentsRelax) contentsRelax.set('input relaxTime here:') self.entryRelaxWidget.config(width=35) 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=0 relaxTime=0 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,0,-1): self.Label1["text"]=j self.root.update() time.sleep(1) 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()
相关推荐
PYTHON做贪吃蛇代码 PYTHON做贪PYTHONPYTHON做贪吃蛇代码做贪吃蛇代码 吃蛇代码 PYTHON做贪吃蛇代码PYTHON做贪吃蛇代码PYPYTHON做贪吃蛇代码THON做贪吃蛇代码PYTHON做贪吃蛇代码PYTHON做PYTHON做贪吃蛇代码贪吃蛇...
用python做的一个简单小游戏,代码很简单,适合新手熟悉语法。
这是《量化交易之路—— 用python做股票量化分析》一书源代码。
用python做的一个让眼睛离开屏幕1分钟的小程序,搭配windows任务计划食用,效果更佳
python python python python pythonpython python python python python
人脸检测进阶:使用 dlib、OpenCV 和 Python 检测眼睛、鼻子、嘴唇和下巴等面部五官,详见:https://blog.csdn.net/hhhhhhhhhhwwwwwwwwww/article/details/121676797?spm=1001.2014.3001.5502
python教程python教程python教程python教程python教程python教程python教程python教程python教程
python教程python教程python教程python教程python教程python教程python教程python教程python教程python教程python教程python教程
Python违规驾驶行为识别系统源码,可用做毕设 Python违规驾驶行为识别系统源码,可用做毕设 Python违规驾驶行为识别系统源码,可用做毕设 Python违规驾驶行为识别系统源码,可用做毕设 Python违规驾驶行为识别...
python识别人脸,眼睛,嘴,在摄像头条件下识别人脸上的五官
用python做的小型聊天室 简单方便
python做的电信流失用户分析,算是标准的分析流程了,需要的同学可以下载
Python聊天机器人,智能问答系统 Python聊天机器人,智能问答系统 Python聊天机器人,智能问答系统 Python聊天机器人,智能问答系统 Python聊天机器人,智能问答系统 Python聊天机器人,智能问答系统 Python...
├─(59) 04 python s3 day49 做一个最简答web框架.avi ├─(60) 05 python s3 day49 MVC模式和MTV模式.avi ├─(61) 06 python s3 day49 django的一个简单应用.avi ├─(62) 07 python s3 day49 django静态文件之...
python 做的电子时钟-源码 python 做的电子时钟-源码 python 做的电子时钟-源码 python 做的电子时钟-源码 python 做的电子时钟-源码 python 做的电子时钟-源码 python 做的电子时钟-源码
用Python做科学计算 2010.pdf
通过Python语言提供的各种模块,我们无需借助Web服务器或者Web浏览器就能够解析和处理HTML文档。本文将详细介绍如何利用Python抓取和解析网页