예제 #1
0
 def __init__(self, matser, _winheight, _winwidth):
     self.winheight = _winheight
     self.winwidth = _winwidth
     self.master = matser
     self.comwidth = 150
     self.comheight = 100
     self.clockimg = ImageTk.PhotoImage(
         Image.open("srcimage/playclock.jpg").resize(
             (int(self.winwidth), int(self.winheight))))
     self.confirmimg = ImageTk.PhotoImage(
         Image.open("srcimage/confirm.jpg").resize(
             (int(self.comwidth), int(self.comheight))))
     self.playclockpage = tk.Canvas(self.master,
                                    bg="pink",
                                    height=self.winheight,
                                    width=self.winwidth)
     self.playclockpage.place(x=0, y=0)
     #背景
     bg = background(self.playclockpage, self.winheight, self.winwidth,
                     "clock")
     #标题
     backbtn(self, self.playclockpage, self.winheight, self.winwidth, 13)
     bg.backgroundcanvas.create_image(0,
                                      0,
                                      anchor="nw",
                                      image=self.clockimg)
     self.combtn = tk.Button(self.playclockpage,
                             image=self.confirmimg,
                             width=self.comwidth,
                             height=self.comheight,
                             command=self.back)
     self.combtn.place(x=(self.winwidth - self.comwidth) / 2, y=750)
     self.playmusic()
예제 #2
0
 def __init__(self, mainclass, master, _winheight, _winwidth):
     self.winheight = _winheight
     self.winwidth = _winwidth
     self.master = master
     self.mainclass = mainclass
     self.imagereadlist = []
     self.topheight = 130  #顶部标题高度
     self.heartpage = tk.Canvas(self.master,
                                bg="pink",
                                width=self.winwidth,
                                height=self.winheight)
     self.heartpage.place(x=0, y=0)
     self.heartpage.configure(highlightthickness=0)
     self.startbtnwidth = 350
     self.working = False
     self.btnimage = ImageTk.PhotoImage(
         Image.open("srcimage/startm.jpg").resize(
             (int(self.startbtnwidth), int(self.startbtnwidth))))
     self.waitingimage = ImageTk.PhotoImage(
         Image.open("srcimage/waiting.jpg").resize(
             (int(self.startbtnwidth), int(self.startbtnwidth))))
     #背景
     bg = background(self.heartpage, self.winheight, self.winwidth, "call")
     #返回按钮
     backbtn(self.heartpage, self.winheight, self.winwidth)
     #标题
     title(self.heartpage, self.winheight, self.winwidth, "心率测量")
     self.startbtn = tk.Button(self.heartpage,
                               image=self.btnimage,
                               width=self.startbtnwidth,
                               height=self.startbtnwidth,
                               command=self.start)
     self.startbtn.place(x=(self.winwidth - self.startbtnwidth) / 2,
                         y=(self.winheight - self.startbtnwidth) / 2)
     bg.showimage()
예제 #3
0
 def __init__(self,master,_winheight,_winwidth):
     self.extensionlist = ['mp4']
     self.videolist = []
     for extension in self.extensionlist:
         file_list = glob.glob('videos/*.' + extension)  #返回一个列表
         for item in file_list:
             self.videolist.append(item[6:])
     self.master = master
     self.master.config(bg='blue')
     self.playing = False #当前是否有视频正在播放
     # 屏幕宽高
     self.winheight = _winheight
     self.winwidth = _winwidth
     self.videowidth = self.winwidth/8
     self.videopadding = self.winwidth/64
     self.topheight = 130 #顶部标题高度
     self.firstimagelist = []
     for n in range(0,len(self.videolist)):
         self.firstimagelist.append(self.getfirstimage(self.videolist[n]))
     # 获取每个视频的第一张图
     # 视频集画框
     self.videocanvas = tk.Canvas(self.master,bg="pink",height=self.winheight,width=self.winwidth)
     self.videocanvas.place(x=0,y=0)
     #背景
     bg = background(self.videocanvas,self.winheight,self.winwidth,"call")
     #返回按钮
     backbtn(self.videocanvas,self.winheight,self.winwidth)
     #标题
     title(self.videocanvas,self.winheight,self.winwidth,"播放视频")
     # 视频缩略图放置
     for n in range(0,len(self.videolist)):
         locals()['self.tempbutton'+str(n)] = tk.Button(self.videocanvas,image=self.firstimagelist[n], width=self.videowidth,height=self.videowidth,command=self.returnfun(n),bd=0)
         locals()['self.tempbutton'+str(n)].place(x=n%7*(self.videowidth+self.videopadding)+self.videopadding,y=int((n+1)/8)*(self.videowidth+self.videopadding)+self.topheight)
     bg.showimage()
예제 #4
0
 def __init__(self, mainclass, matser, _winheight, _winwidth):
     self.mainclass = mainclass
     self.winheight = _winheight
     self.winwidth = _winwidth
     self.master = matser
     self.calling = False
     self.callpage = tk.Frame(self.master,
                              bg="pink",
                              height=self.winheight,
                              width=self.winwidth)
     self.callpage.place(x=0, y=0)
     #背景
     bg = background(self.callpage, self.winheight, self.winwidth, "call")
     #返回按钮
     backbtn(self.mainclass, self.callpage, self.winheight, self.winwidth,
             5)
     #标题
     title(self.callpage, self.winheight, self.winwidth, "打电话给家人")
     self.childlist = ["firstson", "secondson", "thirdson"]
     self.avatarimagelist = []  #头像放置
     self.avatarlabellist = []
     self.numberlist = ["15060356168", "18792858682", "13024999392"]
     #头像高度
     self.avatarpadding = 60
     self.avatarwidth = (self.winwidth - (len(self.childlist) + 1) *
                         self.avatarpadding) / len(self.childlist)
     self.avatrheight = self.avatarwidth / 0.7
     self.iconwidth = 100
     self.iconpadding = 50
     self.callbtnwidth = 125
     self.callbtnheight = 75
     self.callnumberimg = ImageTk.PhotoImage(
         Image.open("srcimage/callnumber.jpg").resize(
             (int(self.callbtnwidth), int(self.callbtnheight))))
     for n in range(0, len(self.childlist)):
         self.avatarimagelist.append(
             ImageTk.PhotoImage(self.goodimage(self.childlist[n])))
         self.avatarlabellist.append(
             tk.Button(self.callpage,
                       width=self.avatarwidth,
                       height=self.avatrheight,
                       image=self.avatarimagelist[n],
                       command=self.returnfun(n)))
         self.avatarlabellist[n].place(
             x=self.avatarpadding +
             (self.avatarwidth + self.avatarpadding) * n,
             y=200)
     self.callbtn = tk.Button(self.callpage,
                              width=self.callbtnwidth,
                              height=self.callbtnheight,
                              image=self.callnumberimg,
                              command=self.call)
     self.callbtn.place(x=self.winwidth - self.callbtnwidth, y=0)
     bg.showimage()
예제 #5
0
파일: heartpage.py 프로젝트: sdlas/intelcub
 def __init__(self, mainclass, master, _winheight, _winwidth, resultlist):
     self.mainclass = mainclass
     self.winheight = _winheight
     self.winwidth = _winwidth
     self.master = master
     self.resultlist = resultlist
     self.fontpadding = 60
     self.fontsize = 30
     if self.resultlist != -1:
         self.resultpage = tk.Canvas(self.master,
                                     bg="greenyellow",
                                     width=self.winwidth,
                                     height=self.winheight)
         self.resultpage.place(x=0, y=0)
         self.resultpage.create_text(self.winwidth / 2,
                                     self.winheight / 2 -
                                     self.fontpadding * 3 / 2,
                                     text="收缩压:" + str(self.resultlist[0]),
                                     font=("宋体", self.fontsize))
         self.resultpage.create_text(self.winwidth / 2,
                                     self.winheight / 2 -
                                     self.fontpadding * 1 / 2,
                                     text="舒张压:" + str(self.resultlist[1]),
                                     font=("宋体", self.fontsize))
         self.resultpage.create_text(self.winwidth / 2,
                                     self.winheight / 2 +
                                     self.fontpadding * 1 / 2,
                                     text="心率:" + str(self.resultlist[2]),
                                     font=("宋体", self.fontsize))
         self.resultpage.create_text(self.winwidth / 2,
                                     self.winheight / 2 +
                                     self.fontpadding * 7 / 4,
                                     text="非常健康,一切指标良好",
                                     font=("宋体", self.fontsize + 5))
         self.writein()
         wordtovoice(self.mainclass, "非常健康,一切指标良好")
         backbtn(self, self.resultpage, self.winheight, self.winwidth, 8)
     else:
         self.resultpage = tk.Canvas(self.master,
                                     bg="red",
                                     width=self.winwidth,
                                     height=self.winheight)
         self.resultpage.place(x=0, y=0)
         self.resultpage.create_text(self.winwidth / 2,
                                     self.winheight / 2,
                                     text="测量出错,请检查仪器是否佩戴正确",
                                     font=("宋体", self.fontsize + 10))
         wordtovoice(self.mainclass, "测量出错,请检查仪器是否佩戴正确")
         backbtn(self, self.resultpage, self.winheight, self.winwidth, 8)
예제 #6
0
 def __init__(self, mainclass, matser, _winheight, _winwidth):
     self.mainclass = mainclass
     self.winheight = _winheight
     self.winwidth = _winwidth
     self.master = matser
     self.hearto2page = tk.Frame(self.master,
                                 bg="pink",
                                 height=self.winheight,
                                 width=self.winwidth)
     self.hearto2page.place(x=0, y=0)
     self.heartratescale = [0, 150]  #心跳速度范围
     self.heartratelength = self.heartratescale[1] - self.heartratescale[0]
     self.oxygenscale = [0, 150]  #血氧浓度范围
     self.oxygenlength = self.oxygenscale[1] - self.oxygenscale[0]
     #背景
     bg = background(self.hearto2page, self.winheight, self.winwidth,
                     "call")
     #返回按钮
     backbtn(self.hearto2page, self.winheight, self.winwidth)
     #标题
     self.testbtn = tk.Button(self.hearto2page,
                              bitmap="error",
                              width=100,
                              height=100,
                              command=self.testbtn)
     self.testbtn.place(x=0, y=0)
     title(self.hearto2page, self.winheight, self.winwidth, "健康检测")
     self.paddingl = 200  #水平的间隙
     self.paddingv = 60  #竖直方向的间隙
     self.matwidth = self.winwidth - self.paddingl * 2
     self.matheight = self.winheight - self.paddingv * 2
     self.perx = self.matwidth / 100
     self.pery = self.matheight / 100
     self.matcanvas = tk.Canvas(self.hearto2page,
                                bg="white",
                                width=self.matwidth,
                                height=self.matheight)
     self.matcanvas.place(x=self.paddingl, y=self.paddingv)
     self.opointx = 10 * self.perx
     self.opointy = 90 * self.pery
     self.yheight = 80 * self.pery
     self.xwidth = 80 * self.perx
     self.drawaxis()  #绘制坐标轴
     # 40,130
     # 85,100
     #bg.showimage()
     #self.updatecan()
     plt.ion()
     plt.figure(1)
예제 #7
0
    def __init__(self, master, _winheight, _winwidth):
        #获取本地图片文件
        self.extensionlist = ['jpg']
        self.imagelist = []
        for extension in self.extensionlist:
            file_list = glob.glob('photos/*.' + extension)  #返回一个列表
            for item in file_list:
                self.imagelist.append(item[7:])

        self.winheight = _winheight
        self.winwidth = _winwidth
        self.photowidth = self.winwidth / 8
        self.photopadding = self.winwidth / 64
        self.master = master
        self.imagereadlist = []
        self.topheight = 130  #顶部标题高度
        #读取图片
        for n in range(0, len(self.imagelist)):
            self.imagereadlist.append(ImageTk.PhotoImage(self.goodimage(n)))
        self.photopage = tk.Canvas(self.master,
                                   bg="pink",
                                   width=self.winwidth,
                                   height=self.winheight)
        self.photopage.place(x=0, y=0)
        self.photopage.configure(highlightthickness=0)
        #背景
        bg = background(self.photopage, self.winheight, self.winwidth, "call")
        #返回按钮
        backbtn(self.photopage, self.winheight, self.winwidth)
        #标题
        title(self.photopage, self.winheight, self.winwidth, "看照片")
        #图片缩略图放置
        for n in range(0, len(self.imagelist)):
            locals()['self.tempbutton' + str(n)] = tk.Button(
                self.photopage,
                image=self.imagereadlist[n],
                width=self.photowidth,
                height=self.photowidth,
                command=self.returnfun(n),
                bd=0)
            locals()['self.tempbutton' + str(n)].place(
                x=n % 7 * (self.photowidth + self.photopadding) +
                self.photopadding,
                y=int((n + 1) / 8) * (self.photowidth + self.photopadding) +
                self.topheight)
        bg.showimage()
예제 #8
0
 def __init__(self, matser, _winheight, _winwidth):
     self.winheight = _winheight
     self.winwidth = _winwidth
     self.master = matser
     self.callpage = tk.Frame(self.master,
                              bg="pink",
                              height=self.winheight,
                              width=self.winwidth)
     self.callpage.place(x=0, y=0)
     #背景
     bg = background(self.callpage, self.winheight, self.winwidth, "call")
     #返回按钮
     backbtn(self.callpage, self.winheight, self.winwidth)
     #标题
     title(self.callpage, self.winheight, self.winwidth, "打电话给家人")
     self.childlist = ["firstson", "secondson", "thirdson"]
     self.avatarimagelist = []  #头像放置
     self.avatarlabellist = []
     #头像高度
     self.avatarpadding = 200
     self.avatarwidth = (self.winwidth - (len(self.childlist) + 1) *
                         self.avatarpadding) / len(self.childlist)
     self.avatrheight = self.avatarwidth / 0.618
     # self.testimage = ImageTk.PhotoImage(Image.open("srcimage/firstson.jpg").resize(
     #     (int(self.avatarwidth), int(self.avatrheight))))
     # self.test = tk.Button(self.callpage,image=self.testimage,width=self.avatarwidth,height=self.avatrheight,command=self.back)
     # self.test.place(x=0,y=0)
     for n in range(0, len(self.childlist)):
         self.avatarimagelist.append(
             ImageTk.PhotoImage(self.goodimage(self.childlist[n])))
         self.avatarlabellist.append(
             tk.Button(self.callpage,
                       width=self.avatarwidth,
                       height=self.avatrheight,
                       image=self.avatarimagelist[n],
                       command=self.back))
         self.avatarlabellist[n].place(
             x=self.avatarpadding +
             (self.avatarwidth + self.avatarpadding) * n,
             y=200)
     bg.showimage()
예제 #9
0
파일: heartpage.py 프로젝트: sdlas/intelcub
 def __init__(self, master, _winheight, _winwidth):
     self.master = master
     self.winheight = _winheight
     self.winwidth = _winwidth
     self.history = tk.Canvas(self.master,
                              bg="pink",
                              width=self.winwidth,
                              height=self.winheight)
     self.history.place(x=0, y=0)
     self.linewidth = 5  #线宽
     self.pointradius = 6
     # 背景
     bg = background(self.history, self.winheight, self.winwidth, "call")
     # 返回按钮
     bb = backbtn(self, self.history, self.winheight, self.winwidth, 9)
     bb.backbtn.place(x=bb.backbtnpadding, y=10)
     self.paddingl = 60  #水平的间隙
     self.paddingv = 50  #竖直方向的间隙
     self.matwidth = self.winwidth - self.paddingl * 2
     self.matheight = self.winheight - self.paddingv * 2
     self.perx = self.matwidth / 100
     self.pery = self.matheight / 100
     self.matcanvas = tk.Canvas(self.history,
                                bg="white",
                                width=self.matwidth,
                                height=self.matheight)
     self.matcanvas.place(x=self.paddingl, y=self.paddingv + 40)
     self.opointx = 10 * self.perx
     self.opointy = 90 * self.pery
     self.yheight = 80 * self.pery
     self.xwidth = 80 * self.perx
     self.highpressurelist = []
     self.highpressurescale = [90, 170]
     self.lowpressurescale = [50, 110]
     self.heartscale = [40, 130]
     self.safescalelist = [[self.highpressurescale[0], 140],
                           [self.lowpressurescale[0], 90], [60, 100]]
     self.lowpressurelist = []
     self.pressurelist = []
     self.datelist = []
     self.switchbtnwidth = 80
     self.switchbtnheight = 50
     self.curid = 0  #当前选择的模块
     self.btnpadding = 10
     self.switchimagenamelist = [
         "highpressure.jpg", "lowpressure.jpg", "heartrate.jpg"
     ]
     self.switchimageablenamelist = [
         "highpressureable.jpg", "lowpressureable.jpg", "heartrateable.jpg"
     ]
     self.switchimagelist = []
     self.switchimageablelist = []
     for i in range(0, len(self.switchimagenamelist)):
         self.switchimagelist.append(
             ImageTk.PhotoImage(
                 Image.open("srcimage/" +
                            self.switchimagenamelist[i]).resize(
                                (int(self.switchbtnwidth),
                                 int(self.switchbtnheight)))))
         self.switchimageablelist.append(
             ImageTk.PhotoImage(
                 Image.open("srcimage/" +
                            self.switchimageablenamelist[i]).resize(
                                (int(self.switchbtnwidth),
                                 int(self.switchbtnheight)))))
     self.menubtnlist = []
     for i in range(0, len(self.switchimagenamelist)):
         self.menubtnlist.append(
             tk.Button(self.matcanvas,
                       image=self.switchimageablelist[i],
                       width=self.switchbtnwidth,
                       height=self.switchbtnheight,
                       command=self.returnfun(i)))
         self.menubtnlist[i].place(
             x=self.btnpadding +
             (self.btnpadding + self.switchbtnwidth) * i,
             y=self.btnpadding)
     self.f = open("doc/heart.txt")
     line = self.f.readline().replace("\n", "")
     count = 0
     while line and count < 5:
         count = count + 1
         self.highpressurelist.append(int(line))
         line = self.f.readline().replace("\n", "")
         self.pressurelist.append(int(line))
         line = self.f.readline().replace("\n", "")
         self.lowpressurelist.append(int(line))
         line = self.f.readline().replace("\n", "")
         templist = []
         templist.append(int(line))
         line = self.f.readline().replace("\n", "")
         templist.append(int(line))
         line = self.f.readline().replace("\n", "")
         templist.append(int(line))
         if len(self.datelist) > 0:
             for i in range(0, 3):
                 if templist[i] != self.datelist[-1][i]:
                     self.datelist.append(templist)
         else:
             self.datelist.append(templist)
         line = self.f.readline().replace("\n", "")
     self.highpressurelength = self.highpressurescale[
         1] - self.highpressurescale[0]
     self.lowpressurelength = self.lowpressurescale[
         1] - self.lowpressurescale[0]
     self.heartlength = self.heartscale[1] - self.heartscale[0]
     self.datevalue = []
     self.scalelist = []
     self.datescale = [
         self.turnvalue(self.datelist[0]),
         self.turnvalue(self.datelist[-1])
     ]
     self.xlist = []
     for i in range(0, len(self.datelist)):
         self.datevalue.append(self.turnvalue(self.datelist[i]))
         self.scalelist.append((self.datevalue[i] - self.datescale[0]) /
                               (self.datescale[1] - self.datescale[0]))
         self.xlist.append(self.opointx +
                           self.perx * 70 * self.scalelist[i])
     self.changecanvas(self.curid)
     bg.showimage()
예제 #10
0
파일: clockpage.py 프로젝트: sdlas/intelcub
 def __init__(self, mainclass, matser, _winheight, _winwidth):
     self.winheight = _winheight
     self.insetting = False
     self.winwidth = _winwidth
     self.master = matser
     self.mainclass = mainclass
     self.clockpage = tk.Frame(self.master,
                               bg="pink",
                               height=self.winheight,
                               width=self.winwidth)
     self.clockpage.place(x=0, y=0)
     self.mainclass.tasklist = []
     self.f = open("doc/clockplan.txt")
     line = self.f.readline()
     while line:
         if int(line) != 0:
             templist = []
             line = self.f.readline().replace("\n", "")
             line = list(line.split(","))
             line = self.transint(line)
             templist.append(line)
             line = self.f.readline().replace("\n", "")
             if int(line) == 0:
                 line = False
             else:
                 line = True
             templist.append(line)
             line = self.f.readline().replace("\n", "")
             line = list(line.split(","))
             line = self.transint(line)
             templist.append(line)
             self.mainclass.tasklist.append(templist)
             line = self.f.readline()
         else:
             self.mainclass.tasklist.append([int(line)])
             line = self.f.readline()
     self.f.close()
     self.taskstrlist = self.translist(self.mainclass.tasklist)
     self.topheight = 130  #顶部标题高度
     self.ypadding = 10
     self.xpadding = 20
     self.taskheight = (self.winheight - self.topheight -
                        8 * self.ypadding) / 3
     self.taskwidth = (self.winwidth - 6 * self.xpadding) / 2
     self.btnwidth = 30
     self.btnheight = 30
     self.btnpadding = 10
     self.btnlist = []
     self.detelebtnlist = []
     self.canvaslist = []
     self.addimage = ImageTk.PhotoImage(
         Image.open("srcimage/add.jpg").resize(
             (int(self.taskwidth), int(self.taskheight))))
     self.editimage = ImageTk.PhotoImage(
         Image.open("srcimage/edit.jpg").resize(
             (int(self.btnwidth), int(self.btnheight))))
     self.closeimage = ImageTk.PhotoImage(
         Image.open("srcimage/close.jpg").resize(
             (int(self.btnwidth), int(self.btnheight))))
     #背景
     bg = background(self.clockpage, self.winheight, self.winwidth, "call")
     #返回按钮
     backbtn(self.mainclass, self.clockpage, self.winheight, self.winwidth,
             6)
     #标题
     title(self.clockpage, self.winheight, self.winwidth, "定时服药提醒")
     self.refresh()
     bg.showimage()
예제 #11
0
    def __init__(self, mainclass, master, _winheight, _winwidth):

        #获取本地音乐文件
        self.mainclass = mainclass
        self.extensionlist = ['mp3', 'flac']
        self.musiclist = []
        for extension in self.extensionlist:
            file_list = glob.glob('music/*.' + extension)  #返回一个列表
            for item in file_list:
                self.musiclist.append(item[6:])

        #尺寸变量
        self.winheight = _winheight
        self.winwidth = _winwidth
        self.photopadding = self.winwidth / 128
        self.photoleftpadding = 300
        self.photowidth = self.winwidth - self.photopadding * 2 - self.photoleftpadding
        self.photoheight = 40
        self.photomovex = (self.winwidth - self.photowidth) / 2
        self.master = master
        self.musicreadlist = []
        self.topheight = 130  #顶部标题高度
        self.backbtnheight = self.topheight / 2
        self.backbtnwidth = self.backbtnheight
        self.backbtnpadding = self.topheight / 4  #顶部按钮的间距
        self.pausebtnwidth = 30
        self.pausebtnmovey = (self.photoheight - self.pausebtnwidth) / 2
        self.pausebtnmovex = self.photowidth - 30 - self.pausebtnwidth
        self.curid = -1
        self.pausemusicflag = False  #是否有音乐暂停
        self.pausemusicid = -1  #暂停的音乐id
        #读取图片
        self.backimg = ImageTk.PhotoImage(
            Image.open("srcimage/toleft.jpg").resize(
                (int(self.backbtnwidth), int(self.backbtnheight))))
        self.pauseimg = ImageTk.PhotoImage(
            Image.open("srcimage/pause.jpg").resize(
                (int(self.pausebtnwidth), int(self.pausebtnwidth))))
        self.playimg = ImageTk.PhotoImage(
            Image.open("srcimage/play.jpg").resize(
                (int(self.pausebtnwidth), int(self.pausebtnwidth))))
        self.musicpage = tk.Canvas(self.master,
                                   bg="pink",
                                   width=self.winwidth,
                                   height=self.winheight)
        self.musicpage.place(x=0, y=0)
        self.musicpage.configure(highlightthickness=0)
        #背景
        bg = background(self.musicpage, self.winheight, self.winwidth, "call")
        #返回按钮
        backbtn(self.mainclass, self.musicpage, self.winheight, self.winwidth,
                1)
        #标题
        title(self.musicpage, self.winheight, self.winwidth, "播放音乐")
        self.Canvaslist = []
        self.pausebtnlist = []
        #图片缩略图放置
        for n in range(0, len(self.musiclist)):
            self.Canvaslist.append(
                tk.Canvas(self.musicpage,
                          bg="white",
                          width=int(self.photowidth),
                          height=int(self.photoheight)))
            self.Canvaslist[n].place(
                x=self.photomovex,
                y=n * (self.photoheight + self.photopadding) + self.topheight)
            self.Canvaslist[n].create_text(self.photowidth / 2,
                                           self.photoheight / 2,
                                           text=self.resolvestr(
                                               self.musiclist[n])[0],
                                           font=("黑体", 15))
            self.pausebtnlist.append(
                tk.Button(self.Canvaslist[n],
                          image=self.playimg,
                          width=self.pausebtnwidth,
                          height=self.pausebtnwidth,
                          command=self.returnfun(n)))
            self.pausebtnlist[n].place(x=self.pausebtnmovex,
                                       y=self.pausebtnmovey)
        bg.showimage()
예제 #12
0
 def __init__(self, master, _winheight, _winwidth):
     self.master = master
     self.winheight = _winheight
     self.winwidth = _winwidth
     self.number = ""
     self.callnumberpage = tk.Canvas(self.master,
                                     width=self.winwidth,
                                     height=self.winheight,
                                     bg="pink")
     self.callnumberpage.place(x=0, y=0)
     self.calling = False  #是否正在打电话
     bg = background(self.callnumberpage, self.winheight, self.winwidth,
                     "call")
     title(self.callnumberpage, self.winheight, self.winwidth, "拨号")
     backbtn(self, self.callnumberpage, self.winwidth, self.winheight, 10)
     self.numberbtnwidth = 60
     self.numberbtnheight = 40
     self.numberbtnpadding = 10
     self.numbercanvaswidth = 320
     self.numbercanvasheight = 50
     self.topheight = 100
     self.movex = [
         self.winwidth / 2 - self.numberbtnwidth * 3 / 2 -
         self.numberbtnpadding, self.winwidth / 2 - self.numberbtnwidth / 2,
         self.winwidth / 2 + self.numberbtnwidth / 2 + self.numberbtnpadding
     ]
     self.movey = [
         self.topheight + 25,
         self.topheight + 60 + self.numbercanvasheight +
         self.numberbtnpadding,
         self.topheight + 60 +
         (self.numbercanvasheight + self.numberbtnpadding) * 2,
         self.topheight + 60 +
         (self.numbercanvasheight + self.numberbtnpadding) * 3,
         self.topheight + 60 +
         (self.numbercanvasheight + self.numberbtnpadding) * 4,
     ]
     self.numbercanvas = tk.Canvas(self.callnumberpage,
                                   width=self.numbercanvaswidth,
                                   height=self.numbercanvasheight,
                                   bg="grey")
     self.numbercanvas.place(x=(self.winwidth - self.numbercanvaswidth) / 2,
                             y=self.movey[0])
     self.btnlist = []
     self.btnvalue = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 11, 10]
     self.imagenamelist = [
         "1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg", "6.jpg", "7.jpg",
         "8.jpg", "9.jpg", "0.jpg", "del.jpg", "call.jpg"
     ]
     self.imagelist = []
     self.offphoneimg = ImageTk.PhotoImage(
         Image.open("srcimage/offphone.jpg").resize(
             (int(self.numberbtnwidth), int(self.numberbtnheight))))
     for i in range(0, len(self.imagenamelist)):
         self.imagelist.append(
             ImageTk.PhotoImage(
                 Image.open("srcimage/" + self.imagenamelist[i]).resize(
                     (int(self.numberbtnwidth),
                      int(self.numberbtnheight)))))
     for i in range(0, len(self.btnvalue)):
         self.btnlist.append(
             tk.Button(self.callnumberpage,
                       image=self.imagelist[i],
                       width=self.numberbtnwidth,
                       height=self.numberbtnheight,
                       command=self.returnfun(i)))
         self.btnlist[i].place(x=self.movex[i % 3],
                               y=self.movey[int(i / 3) + 1])
     bg.showimage()
예제 #13
0
파일: envpage.py 프로젝트: sdlas/intelcub
 def __init__(self, mainclass, matser, _winheight, _winwidth):
     self.mainclass = mainclass
     self.winheight = _winheight
     self.winwidth = _winwidth
     self.master = matser
     self.envpage = tk.Frame(self.master,
                             bg="pink",
                             height=self.winheight,
                             width=self.winwidth)
     self.envpage.place(x=0, y=0)
     #背景
     bg = background(self.envpage, self.winheight, self.winwidth, "call")
     #返回按钮
     backbtn(self.mainclass, self.envpage, self.winheight, self.winwidth, 3)
     #标题
     title(self.envpage, self.winheight, self.winwidth, "环境监测")
     self.fontsize = 20
     self.topheight = 130
     self.canvaswidth = 150
     self.canvasheight = 50
     self.sidepaddingx = 60
     self.toppaddingy = 50
     self.xpadding = (self.winwidth - self.canvaswidth * 4 -
                      self.sidepaddingx * 2) / 3
     self.ypadding = 80
     self.q = 30
     self.tipscanvaswidth = 350
     self.tipscanvasheight = 180
     self.movex = [
         self.sidepaddingx + self.q,
         self.sidepaddingx + self.canvaswidth + self.xpadding - self.q,
         self.sidepaddingx + (self.canvaswidth + self.xpadding) * 2 +
         self.q,
         self.sidepaddingx + (self.canvaswidth + self.xpadding) * 3 -
         self.q,
     ]
     self.movey = [
         self.topheight + self.toppaddingy, self.topheight +
         self.toppaddingy + self.canvasheight + self.ypadding
     ]
     self.namelist = ["温度:", "湿度:", "PM2.5:", "PM10.0:"]
     self.numlist = ["20.0℃", "50.0%", "12ug/m3", "10ug/m3"]
     self.canvaslist = []
     self.numcanvaslist = []
     self.infoimg = ImageTk.PhotoImage(
         Image.open("srcimage/info.jpg").resize(
             (int(self.tipscanvaswidth), int(self.tipscanvasheight))))
     for i in range(0, len(self.namelist)):
         self.canvaslist.append(
             tk.Canvas(self.envpage,
                       bg="yellowgreen",
                       width=self.canvaswidth,
                       height=self.canvasheight))
         self.numcanvaslist.append(
             tk.Canvas(self.envpage,
                       bg="white",
                       width=self.canvaswidth,
                       height=self.canvasheight))
         self.canvaslist[i].place(x=self.movex[i % 2 * 2],
                                  y=self.movey[int(i / 2)])
         self.numcanvaslist[i].place(x=self.movex[i % 2 * 2 + 1],
                                     y=self.movey[int(i / 2)])
         self.canvaslist[i].create_text(self.canvaswidth / 2,
                                        self.canvasheight / 2,
                                        text=self.namelist[i],
                                        font=("宋体", self.fontsize))
         self.numcanvaslist[i].create_text(self.canvaswidth / 2,
                                           self.canvasheight / 2,
                                           text=self.numlist[i],
                                           font=("宋体", self.fontsize))
     self.tipscanvas = tk.Canvas(self.envpage,
                                 width=self.tipscanvaswidth,
                                 height=self.tipscanvasheight)
     self.tipscanvas.create_image(0, 0, anchor="nw", image=self.infoimg)
     self.tipscanvas.place(x=self.winwidth - self.tipscanvaswidth,
                           y=self.winheight - self.tipscanvasheight)
     _thread.start_new_thread(self.fresh, ("threadname", 1))
     self.played = False
     bg.showimage()