Exemple #1
0
    def __createUI(self):
        # 日志信息
        self.logBox = mtk.LabelFrame(self.root, text="日志信息", fg="blue")
        self.logBox.place(x=20, y=20, width=250, height=260)
        self.logText = scrolledtext.ScrolledText(self.logBox, fg="green")
        self.logText.place(x=20, y=15, width=220, height=210)
        # Excel数据
        self.excelDataBox = mtk.LabelFrame(self.root, text="当前数据", fg="blue")
        self.excelDataBox.place(x=290, y=20, width=180, height=80)
        self.dataNum = mtk.Label(self.excelDataBox, text="当前数据数量:")
        self.dataNum.place(x=10, y=10, width=100, height=30)
        self.dataNumText = mtk.Label(self.excelDataBox, text=0)
        self.dataNumText.place(x=115, y=10, width=30, height=30)

        # taskInfo
        self.taskInfoBox = mtk.LabelFrame(self.root, text="启动任务", fg="blue")
        self.taskInfoBox.place(x=290, y=120, width=180, height=160)
        self.excelExportInBtn = mtk.Button(self.taskInfoBox, text="导入Excel",
                                           command=lambda: self.thread_it(self.excelExportIn))
        self.excelExportInBtn.place(x=15, y=20, width=80, height=35)
        self.excelExportOutBtn = mtk.Button(self.taskInfoBox, text="导出Excel",
                                            command=lambda: self.thread_it(self.excelExportOut))
        self.excelExportOutBtn.place(x=15, y=80, width=80, height=35)
        self.taskStartBtn = mtk.Button(self.taskInfoBox, text="开始", command=lambda: self.thread_it(self.start))
        self.taskStartBtn.place(x=110, y=20, width=50, height=90)
Exemple #2
0
 def draw_card(self, x, y, card):
     if card is None:
         tk.Button(self.window,
                   bg="black",
                   fg="white",
                   width=40,
                   height=90,
                   image=self.pixel_virtual,
                   command=partial(self.choose_card, None)).place(x=x, y=y)
         tk.Label(self.window, text="?").place(x=x + 20, y=y + 45)
     else:
         if card.color == 0:
             for i in range(1, 5):
                 card.color = i
                 tk.Button(self.window,
                           fg="white",
                           bg=card.get_color_string(),
                           width=40,
                           height=90 / 4,
                           image=self.pixel_virtual,
                           command=partial(self.choose_card,
                                           copy.deepcopy(card))).place(
                                               x=x, y=y + 90 / 4 * (i - 1))
             card.color = 0
         else:
             tk.Button(self.window,
                       fg="white",
                       bg=card.get_color_string(),
                       width=40,
                       height=90,
                       image=self.pixel_virtual,
                       command=partial(self.choose_card, card)).place(x=x,
                                                                      y=y)
         tk.Label(self.window, text=card.get_value_string()).place(x=x + 10,
                                                                   y=y + 45)
Exemple #3
0
    def createPage(self):
        self.login = mtk.LabelFrame(self.root, text="登录", fg="blue")
        self.login.place(x=30, y=50, width=380, height=250)

        self.label_asino = mtk.Label(self.login, text="AsiNumber:")
        self.label_asino.place(x=30, y=10, width=75, height=25)
        self.entry_asino = mtk.Entry(self.login)
        self.entry_asino.place(x=120, y=10, width=220, height=25)

        self.label_user = mtk.Label(self.login, text="账号:")
        self.label_user.place(x=30, y=65, width=75, height=25)
        self.entry_user = mtk.Entry(self.login)
        self.entry_user.place(x=120, y=65, width=220, height=25)

        self.label_passwd = mtk.Label(self.login, text="密码:")
        self.label_passwd.place(x=30, y=120, width=75, height=25)
        self.entry_passwd = mtk.Entry(self.login, show="*")
        self.entry_passwd.place(x=120, y=120, width=220, height=25)

        self.btn_logins = mtk.Button(
            self.login,
            text="自动登录",
            command=lambda: self.thread_it(self.loginSelf))
        self.btn_logins.place(x=40, y=170, width=100, height=30)

        self.btn_login = mtk.Button(
            self.login,
            text="登录",
            command=lambda: self.thread_it(self.loginContent))
        self.btn_login.place(x=220, y=170, width=100, height=30)
Exemple #4
0
    def __createUI(self):

        # 博轩下载设置
        self.settingsBox = mtk.LabelFrame(self.root, text="下载设置", fg="blue")
        self.settingsBox.place(x=20, y=20, width=260, height=250)
        # 网站选择
        self.siteLable = mtk.Label(self.settingsBox, text="互联网平台:")
        self.siteLable.place(x=25, y=20, width=75, height=25)
        self.siteSelect = ttk.Combobox(self.settingsBox)
        self.siteSelect["values"] = ["360图书馆", "39康复网", "中医世家", "中医人", "中医中药秘方网", "中医中药网", "经方派", "新浪博文", "好大夫在线"]
        self.siteSelect.place(x=115, y=20, width=100, height=25)

        # 页面属性
        self.siteCls = mtk.Label(self.settingsBox, text="页面选择:")
        self.siteCls.place(x=25, y=65, width=65, height=25)
        self.siteClsSelect = ttk.Combobox(self.settingsBox)
        self.siteClsSelect["values"] = ["列表页", "内容页"]
        self.siteClsSelect.place(x=115, y=65, width=100, height=25)

        # 链接
        self.labelUrl = mtk.Label(self.settingsBox, text="链接:")
        self.labelUrl.place(x=25, y=110, width=40, height=25)
        self.urlText = mtk.Text(self.settingsBox)
        self.urlText.place(x=75, y=110, width=160, height=50)
        self.urlText.bind(sequence="<Double-Button-1>", func=lambda x: self.thread_it(self.loadErrors))
        # 任务按钮
        self.startBtn = mtk.Button(self.settingsBox, text="开始", command=lambda: self.thread_it(self.start))
        self.startBtn.place(x=25, y=180, width=80, height=35)
        self.stopBtn = mtk.Button(self.settingsBox, text="停止")
        self.stopBtn.place(x=135, y=180, width=80, height=35)
Exemple #5
0
    def createPage(self):
        self.loginBox = mtk.LabelFrame(self.loginPage, text="账号登录", fg="blue")
        self.loginBox.place(x=30, y=30, width=300, height=280)

        self.userName = mtk.Label(self.loginBox, text="账号:")
        self.userName.place(x=20, y=20, width=50, height=30)
        self.userNameText = mtk.Entry(self.loginBox)
        self.userNameText.place(x=90, y=20, width=150, height=30)

        self.passWord = mtk.Label(self.loginBox, text="密码:")
        self.passWord.place(x=20, y=70, width=50, height=30)
        self.passWordText = mtk.Entry(self.loginBox)
        self.passWordText.place(x=90, y=70, width=150, height=30)

        # self.keyValue = mtk.Label(self.loginBox, text="KEY:")
        # self.keyValue.place(x=20, y=120, width=50, height=30)
        self.keyValueText = mtk.Entry(self.loginBox, show="*")
        self.keyValueText.place(x=90, y=120, width=150, height=30)

        self.loginBtn = mtk.Button(self.loginBox,
                                   text="登录",
                                   command=lambda: self.thread_it(self.login))
        self.loginBtn.place(x=150, y=180, width=80, height=30)

        self.logoutBtn = mtk.Button(self.loginBox,
                                    text="退出",
                                    command=lambda: self.thread_it(self.stop))
        self.logoutBtn.place(x=40, y=180, width=80, height=30)
Exemple #6
0
 def __init__(self):     # 窗口初始化
     self.windows = tk.Tk()      # 生成窗口
     self.windows.title('project')
     self.windows.geometry('300x300')    # 设置窗口尺寸
     # 创建并设置按钮
     self.show_tag_bt = tk.Button(master=self.windows, text='显示tag比例', command=self.show_img)
     self.show_tag_bt.pack(pady=20)
     self.find_tag_bt = tk.Button(master=self.windows, text='查找关联tag比例',command=self.show_tag)
     self.find_tag_bt.pack(pady=20)
     self.windows.mainloop()
Exemple #7
0
    def __creatUI(self):
        self.box = mtk.LabelFrame(self.root)
        self.box.place(x=20, y=20, width=340, height=400)

        self.user_name = mtk.Label(self.box, text="账  号:")
        self.user_name.place(x=20, y=20, width=60, height=25)
        self.user_name_text = mtk.Entry(self.box)
        self.user_name_text.place(x=80, y=20, width=100, height=25)

        self.pass_word = mtk.Label(self.box, text="密  码:")
        self.pass_word.place(x=20, y=70, width=60, height=25)
        self.password_text = mtk.Entry(self.box)
        self.password_text.place(x=80, y=70, width=100, height=25)

        self.loginadd = mtk.Label(self.box, text="登录地:")
        self.loginadd.place(x=20, y=120, width=60, height=25)
        self.loginaddsel = ttk.Combobox(self.box)
        self.loginaddsel["values"] = [
            "上海总部", "上海物流", "甘肃", "河北", "西北", "山西", "浙江", "安徽", "山东", "江西",
            "武汉", "北京", "江苏", "四川", "广东"
        ]
        self.loginaddsel.place(x=80, y=120, width=100, height=25)

        self.verify_code = mtk.Label(self.box, text="验证码:")
        self.verify_code.place(x=20, y=170, width=60, height=25)
        self.verify_code_text = mtk.Entry(self.box)
        self.verify_code_text.place(x=80, y=170, width=100, height=25)

        self.exam_name = mtk.Label(self.box, text="考试名称:")
        self.exam_name.place(x=20, y=220, width=60, height=25)
        self.exam_name_text = mtk.Entry(self.box)
        self.exam_name_text.place(x=80, y=220, width=100, height=25)

        self.loadbtn = mtk.Button(
            self.box,
            text="加载题型",
            command=lambda: self.thread_it(self.__loadExcel))
        self.loadbtn.place(x=210, y=20, width=100, height=50)

        self.startbtn = mtk.Button(self.box,
                                   text="开始",
                                   command=lambda: self.thread_it(self.start))
        self.startbtn.place(x=210, y=100, width=100, height=50)

        self.stopbtn = mtk.Button(self.box,
                                  text="退出",
                                  command=lambda: self.thread_it(self.stop))
        self.stopbtn.place(x=210, y=180, width=100, height=50)

        self.logs = mtk.LabelFrame(self.box, text="信息", fg="blue")
        self.logs.place(x=20, y=270, width=300, height=120)
        self.logtext = scrolledtext.ScrolledText(self.logs, fg="green")
        self.logtext.place(x=20, y=10, width=270, height=80)
Exemple #8
0
    def create_root(self):
        """
        Description
        -----------
        Sets up all the parameters for the gui (text, buttons, entry boxes, etc.)

        Returns
        -------
        None
        """
        self.root = tk.Tk()
        self.root.title('Ultra Deluxe Focus Control Hub EXTREME')
        self.root.geometry('430x140')

        connection_text = tk.Label(self.root,
                                   text='The focuser is connected to: ')
        connection_text.grid(row=1, column=1)
        self.comport_var = tk.StringVar()
        self.comport_var.set(self.focuser.comport)
        self.comport = tk.Label(self.root, textvariable=self.comport_var)
        self.comport.grid(row=1, column=2)

        self.position = tk.IntVar()
        self.position.set(self.focuser.position)
        position_msg = tk.Label(self.root, text='The current position is: ')
        position_msg.grid(row=2, column=1)
        self.position_text = tk.Label(self.root, textvariable=self.position)
        self.position_text.grid(row=2, column=2)

        self.delta = tk.IntVar()
        self.delta.set(config_reader.get_config().initial_focus_delta)
        delta_entry = tk.Entry(self.root, textvariable=self.delta, width=5)
        delta_entry.grid(row=3, column=2)
        button_frame = tk.Frame(self.root)
        self.move_in = tk.Button(
            button_frame,
            text='MOVE IN',
            state=tk.DISABLED,
            command=lambda: self.move_in_cmd(self.delta.get()))
        self.move_out = tk.Button(
            button_frame,
            text='MOVE OUT',
            state=tk.DISABLED,
            command=lambda: self.move_out_cmd(self.delta.get()))
        button_frame.grid(row=3, column=1, sticky="nsew", pady=10, padx=20)
        self.move_in.pack(side="left")
        self.move_out.pack(side="right")
        abort = tk.Button(self.root,
                          text='ABORT',
                          command=self.abort_cmd,
                          width=15)
        abort.grid(row=4, column=1, columnspan=2)
Exemple #9
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 = 200
     self.working = False
     self.inhistory = False
     self.xmove = 125
     self.btnimage = ImageTk.PhotoImage(
         Image.open("srcimage/startm.jpg").resize(
             (int(self.startbtnwidth), int(self.startbtnwidth))))
     self.historyimage = ImageTk.PhotoImage(
         Image.open("srcimage/history.jpg").resize(
             (int(self.startbtnwidth), int(self.startbtnwidth))))
     # 背景
     bg = background(self.heartpage, self.winheight, self.winwidth, "call")
     # 返回按钮
     backbtn(self.mainclass, self.heartpage, self.winheight, self.winwidth,
             7)
     # 标题
     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 -
                         self.xmove,
                         y=(self.winheight - self.startbtnwidth) / 2)
     self.hbtn = tk.Button(self.heartpage,
                           image=self.historyimage,
                           width=self.startbtnwidth,
                           height=self.startbtnwidth,
                           command=self.seehistory)
     self.hbtn.place(x=(self.winwidth - self.startbtnwidth) / 2 +
                     self.xmove,
                     y=(self.winheight - self.startbtnwidth) / 2)
     bg.showimage()
Exemple #10
0
    def createPage(self):
        self.infoBox = mtk.LabelFrame(self.root, text="搜索框", fg="blue")
        self.infoBox.place(x=20, y=20, width=540, height=100)

        self.kw = mtk.Label(self.infoBox, text="关键词:")
        self.kw.place(x=20, y=20, width=50, height=25)
        self.kwText = mtk.Entry(self.infoBox)
        self.kwText.place(x=80, y=20, width=150, height=25)

        self.searchTime = mtk.Label(self.infoBox, text="搜索时间:")
        self.searchTime.place(x=280, y=20, width=60, height=25)
        self.stText = ttk.Combobox(self.infoBox)
        self.stText.place(x=350, y=20, width=100, height=25)
        self.stText["values"] = [
            "7 Days", "14 Days", "30 Days", "45 Days", "60 Days", "90 Days",
            "1 Year"
        ]

        self.log = mtk.LabelFrame(self.root, text="log日志", fg="blue")
        self.log.place(x=20, y=140, width=300, height=350)
        self.logtext = scrolledtext.ScrolledText(self.log, fg="green")
        self.logtext.place(x=20, y=15, width=270, height=300)

        self.status = mtk.LabelFrame(self.root, text="当前进度", fg="blue")
        self.status.place(x=340, y=140, width=220, height=150)

        self.indexnow = mtk.Label(self.status, text="当前条数:")
        self.indexnow.place(x=20, y=20, width=60, height=25)
        self.indexnowText = mtk.Label(self.status, text="0 条")
        self.indexnowText.place(x=90, y=20, width=50, height=25)

        self.indexTotals = mtk.Label(self.status, text="总条数:")
        self.indexTotals.place(x=20, y=65, width=60, height=25)
        self.indexTotalsText = mtk.Label(self.status, text="0 条")
        self.indexTotalsText.place(x=90, y=65, width=50, height=25)

        self.btnBox = mtk.LabelFrame(self.root)
        self.btnBox.place(x=340, y=320, width=220, height=170)

        self.startbtn = mtk.Button(self.btnBox,
                                   text="开始",
                                   command=lambda: self.thread_it(self.start))
        self.startbtn.place(x=40, y=20, width=120, height=40)
        self.loadoutbtn = mtk.Button(
            self.btnBox,
            text="导出",
            command=lambda: self.thread_it(self.export))
        self.loadoutbtn.place(x=40, y=100, width=120, height=40)
Exemple #11
0
def main():
    """
    Begins the program and starts up the login window
    Calls the necessary functions to create the window and
    Binds controls and buttons in order to et to the next window
    """
    login_root = tk.Tk()
    login_root.wm_title("Login to Server")
    url = tk.Label(login_root, text="URL: ")
    username = tk.Label(login_root, text="Username: "******"Password: "******"IP (XX-XX-XXX-XXX): ")
    entry_url = tk.Entry(login_root, width=30)
    entry_ip = tk.Entry(login_root, width=30)
    entry_user = tk.Entry(login_root, width=30)
    entry_pass = tk.Entry(login_root, show="*", width=30)
    url.grid(row=0, sticky=tk.E)
    ip.grid(row=1, sticky=tk.E)
    username.grid(row=2, sticky=tk.E)
    password.grid(row=3, sticky=tk.E)
    entry_url.grid(row=0, column=1, sticky=tk.E)
    entry_ip.grid(row=1, column=1, sticky=tk.E)
    entry_user.grid(row=2, column=1, sticky=tk.E)
    entry_pass.grid(row=3, column=1, sticky=tk.E)
    global attempts
    login_root.bind(
        "<Return>",
        lambda x: checkcreds(login_root, entry_url.get(), entry_user.get(),
                             entry_pass.get(), entry_ip.get()))
    submit = tk.Button(login_root,
                       text="Login",
                       command=lambda: checkcreds(login_root, entry_url.get(
                       ), entry_user.get(), entry_pass.get(), entry_ip.get()))
    submit.grid(row=4, columnspan=2)
    login_root.mainloop()
    def __init__(self, parent, **kwargs):
        tk.Frame.__init__(self, parent, **kwargs)

        self.scan_number_Var = tk.StringVar()

        self.photo = tk.PhotoImage(master=self, file="misc/folder.gif")
        # Creating the GUI elements
        self.path_file_entries_LF = ttk.LabelFrame(
            self,
            text="Path and File Name",
        )
        self.folder_Label = ttk.Label(
            self.path_file_entries_LF,
            text="Folder:",
        )
        self.folder_path_Entry = ttk.Entry(
            self.path_file_entries_LF,
            width=30,
            state="disabled",
        )
        self.folder_path_choose_Button = tk.Button(
            self.path_file_entries_LF,
            height=15,
            width=20,
            state="disabled",
            command=self.get_folder_path,
            image=self.photo,
        )
        self.file_name_Label = ttk.Label(self.path_file_entries_LF,
                                         text="File name:")
        self.file_name_Entry = ttk.Entry(
            self.path_file_entries_LF,
            width=30,
            state="disabled",
        )
        self.scan_number_Label = ttk.Label(self.path_file_entries_LF,
                                           textvariable=self.scan_number_Var)

        # Sticking to the grid
        self.path_file_entries_LF.grid(column=0,
                                       row=0,
                                       columnspan=3,
                                       rowspan=2,
                                       padx=5,
                                       pady=5)
        self.folder_Label.grid(column=0, row=0)
        self.folder_path_Entry.grid(
            column=1,
            row=0,
            padx=5,
            pady=5,
        )
        self.folder_path_choose_Button.grid(
            column=2,
            row=0,
            padx=5,
        )
        self.file_name_Label.grid(column=0, row=1)
        self.file_name_Entry.grid(column=1, row=1, padx=5, pady=5)
        self.scan_number_Label.grid(column=2, row=1, padx=5, pady=5)
Exemple #13
0
 def create_next_button(self, event):
     #method to make button that resets the current guess and chosen pokemon
     #then picks new pokemon and asks user for guess again
     self.next_question = tk.Button(self,
                                    text="Next Question",
                                    command=self.reset_question)
     self.next_question.pack(side="right")
Exemple #14
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()
Exemple #15
0
def create_plugin_control(master, plugin_name, row_num, status_label):
    tk.Label(master, text=plugin_name,
             font='Helvetica 14 bold').grid(row=row_num,
                                            column=0,
                                            ipadx=20,
                                            ipady=20)
    tk.Button(master,
              text="Start",
              command=lambda: switch_plugin(plugin_name, 1)).grid(row=row_num,
                                                                  column=1)
    tk.Button(master,
              text="Stop",
              command=lambda: switch_plugin(plugin_name, 0)).grid(row=row_num,
                                                                  column=2)
    l = tk.Label(master, text="")
    l.grid(row=row_num, column=3, ipadx=10)
    l.config(bg='orange')
    status_label[row_num] = l
def load_ui(tab_rfid):
    # Toggle On/Off button
    config.submitBtn = mtk.Button(tab_rfid,
                                  text="Enable RFID Reader",
                                  command=lambda: rfid_on(config.submitBtn),
                                  height=1,
                                  width=25)
    config.submitBtn.place(x=0 + BORDER, y=400 + BORDER)

    # Clear textbox button
    clearBtn = mtk.Button(tab_rfid,
                          text="Clear",
                          command=clear,
                          height=1,
                          width=10)
    clearBtn.place(x=235 + BORDER, y=400 + BORDER)

    # Clear textbox button
    resetBtn = mtk.Button(tab_rfid,
                          text="Reset",
                          command=reset,
                          height=1,
                          width=10)
    resetBtn.place(x=350 + BORDER, y=400 + BORDER)

    # Label
    resultLabel = mtk.Label(tab_rfid,
                            text="Output",
                            background='black',
                            foreground='white',
                            width=78,
                            height=1)
    resultLabel.place(x=0 + BORDER, y=0 + BORDER)

    # Scrolling textbox
    config.resultScrolledText = st.ScrolledText(tab_rfid,
                                                background='black',
                                                foreground='white',
                                                width=78,
                                                height=23)
    config.resultScrolledText.place(x=0 + BORDER, y=20 + BORDER)
Exemple #17
0
	def makeView(self, master):
		bg = master.cget('bg')
		frame = mtk.Frame(master, bg=bg)
		self.buttonbg = convertToColorCode(master, chooseButtonColor(self.grabConfigArg("buttoncolor")))
		self.buttonTk = mtk.Button(	frame, text=self.label, #anchor='w', 
					bg=self.buttonbg, 
					activebackground=colorscale(self.buttonbg, 0.95),
					image=self.image, compound = mtk.TOP,
					command = self.onClick, **self.args)
		self.buttonTk.pack(padx=5, pady=5)
		#frame.pack(fill=mtk.X, expand=True)
		return frame
Exemple #18
0
	def makeView(self, master):
		frame = mtk.Frame(master, **self.configArgs)
		bg = frame.cget('bg')
		holder = mtk.Frame(frame, bg=bg)
		self.ent = EntryField("", self.label, defaultEntry=self.defaultEntry, enterCallback=self.onEnter)
		self.ent.config(**self.configArgs)
		entTk = self.ent.makeView(holder)
		b = mtk.Button(entTk, text="...", bg=chooseButtonColor(self.grabConfigArg("buttoncolor")), command = self.onClick)
		b.pack(side=mtk.RIGHT, padx=(5,0), pady=1)
		holder.pack(fill=mtk.X, pady=5)
		frame.pack()
		return frame
 def __init__(self):
     self.showTagWin = tk.Tk()
     self.showTagWin.title('查找tag')
     self.showTagWin.geometry('300x200')
     self.showTagWin.protocol("WM_DELETE_WINDOW", self.showTagWin.quit())
     self.tag_input_lb = tk.Label(master=self.showTagWin, text='请输入tag:')
     self.tag_input_lb.pack(side=tk.LEFT, padx=5, pady=20)
     self.tag_input_txt = tk.Entry(master=self.showTagWin)
     self.tag_input_txt.pack(side=tk.LEFT, padx=5, pady=20)
     self.show_bt = tk.Button(master=self.showTagWin, text='显示', command=self.find)
     self.show_bt.pack(side=tk.LEFT, padx=10, pady=50)
     self.showTagWin.mainloop()
 def __init__(self, **data):
     self.show_win = tk.Tk()
     self.show_win.title('tag比例')
     self.show_win.protocol("WM_DELETE_WINDOW", self.show_win.quit())
     self.fig = Figure(figsize=(10, 8), dpi=100)  # 设置画布绘制时需要的参数绘制的尺寸与分辨率
     self.sub_plot = self.fig.add_subplot(111)  # 设置绘制的图的位置
     self.ok_bt = tk.Button(master=self.show_win,
                            text='确定',
                            command=self.ok,
                            padx=50).pack(side=tk.BOTTOM)
     self.draw(**data)
     self.show_win.mainloop()
Exemple #21
0
 def makeView(self, master):
     bg = master.cget('bg')
     frame = mtk.Frame(master, bg=bg)
     buttonbg = convertToColorCode(
         master, chooseButtonColor(self.grabConfigArg("buttoncolor")))
     b = mtk.Button(frame,
                    text=self.label,
                    anchor='w',
                    bg=buttonbg,
                    activebackground=colorscale(buttonbg, 0.95),
                    command=self.onClick,
                    **self.args)
     b.pack(padx=5, pady=5)
     return frame
Exemple #22
0
    def __creatUI(self):
        self.box = mtk.LabelFrame(self.root)
        self.box.place(x=20, y=20, width=340, height=400)

        self.user_name = mtk.Label(self.box, text="账  号:")
        self.user_name.place(x=20, y=20, width=60, height=25)
        self.user_name_text = mtk.Entry(self.box)
        self.user_name_text.place(x=80, y=20, width=100, height=25)

        self.pass_word = mtk.Label(self.box, text="密  码:")
        self.pass_word.place(x=20, y=70, width=60, height=25)
        self.password_text = mtk.Entry(self.box)
        self.password_text.place(x=80, y=70, width=100, height=25)

        self.verify_code = mtk.Label(self.box, text="验证码:")
        self.verify_code.place(x=20, y=120, width=60, height=25)
        self.verify_code_text = mtk.Entry(self.box)
        self.verify_code_text.place(x=80, y=120, width=100, height=25)

        self.exam_name = mtk.Label(self.box, text="考试名称:")
        self.exam_name.place(x=20, y=170, width=60, height=25)
        self.exam_name_text = mtk.Entry(self.box)
        self.exam_name_text.place(x=80, y=170, width=100, height=25)

        self.loadbtn = mtk.Button(self.box, text="加载题型", command=lambda: self.thread_it(self.__loadExcel))
        self.loadbtn.place(x=210, y=20, width=100, height=50)

        self.startbtn = mtk.Button(self.box, text="开始", command=lambda: self.thread_it(self.start))
        self.startbtn.place(x=210, y=85, width=100, height=50)

        self.stopbtn = mtk.Button(self.box, text="退出", command=lambda: self.thread_it(self.stop))
        self.stopbtn.place(x=210, y=150, width=100, height=50)

        self.logs = mtk.LabelFrame(self.box, text="信息", fg="blue")
        self.logs.place(x=20, y=210, width=300, height=170)
        self.logtext = scrolledtext.ScrolledText(self.logs, fg="green")
        self.logtext.place(x=20, y=10, width=270, height=130)
Exemple #23
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)
Exemple #24
0
    def __init__(self,pid = None):
        self.closed = False
        self.pid = PID(1.2,1,0.001)
        if pid is not None:
            self.pid = pid
        #how many inputs are in the graph at a time
        self.x_interval = 30
        self.output = 0
        self.x = []
        self.y = []
        self.start = 0
        self.line = None
        self.root = Tk.Tk()
        self.root.title("Brought to you by Your Mom and co.")
        fig = plt.Figure()

        #bunch of labels & their position on the grid. play around to figure it out
        self.error_label = Tk.Label(self.root,text= "Your Mom")
        self.error_label.grid(column = 5, row = 0)
        p_label = Tk.Label(self.root,text= "P Constant").grid(column = 0, row = 0)
        i_label = Tk.Label(self.root,text= "I Constant").grid(column = 1, row = 0)
        d_label = Tk.Label(self.root,text= "D Constant").grid(column = 2, row = 0)
        pid_label = Tk.Label(self.root,text= "PID Setpoint").grid(column = 3, row = 0)
        #we only care about the text in the box. All other elements work on their own with Tkinter
        self.p_constant = Tk.Text(self.root,height = 2, width = 10, bg = "light yellow")
        self.p_constant.grid(column = 0, row = 1)
        self.i_constant = Tk.Text(self.root,height = 2, width = 10, bg = "light yellow")
        self.i_constant.grid(column = 1, row = 1)
        self.d_constant = Tk.Text(self.root,height = 2, width = 10, bg = "light yellow")
        self.d_constant.grid(column = 2, row = 1)
        self.sp = Tk.Text(self.root,height = 2, width = 10, bg = "light yellow")
        self.sp.grid(column = 3, row = 1)
    
        changePID = Tk.Button(self.root,text = "Change PID value", command = self.change_PID).grid(column = 1, row = 2)
    
        self.canvas = FigureCanvasTkAgg(fig,master = self.root)
        self.canvas.get_tk_widget().grid(column = 4, row = 3)
        #create a plot and put it into matplot's figure. 111 divides into 1 row & 1 column of plot
        #refers to the online doc. But yeah, we only need 1 plot.
        ax = fig.add_subplot(111)
        #set x and y axis. This can be put into variable in future sprint.
        ax.set_ylim([-180,180])
        ax.set_xlim([0,self.x_interval])
        #matplot automatically draw the line from a list of x and y values. line need to be redraw again and again
        self.line, = ax.plot(self.x, self.y)
        def on_closing():
            self.closed = True
            self.root.destroy()
        self.root.protocol("WM_DELETE_WINDOW", on_closing)
Exemple #25
0
    def create_widgets(self):
        self.username = tk.StringVar()
        self.username.set("Enter Your Username Here")
        self.user_entry = tk.Entry(self, textvariable=self.username)
        self.user_entry.pack(side="top")
        self.user_entry.bind('<Key-Return>', self.create_user)
        self.user_entry.bind('<Key-Return>', self.pick_pokemon_with_image, '+')
        self.user_entry.bind('<Key-Return>', self.display_image, '+')
        self.user_entry.bind('<Key-Return>', self.replace_user_with_guess, '+')

        self.quit_button = tk.Button(self,
                                     text="QUIT",
                                     fg="red",
                                     command=self.quit)
        self.quit_button.pack(side="bottom")
Exemple #26
0
    def __init__(self):
        print('search all ips on network')

        self.root = mtTkinter.Tk()
        self.root.title('available IP\'s')
        self.root.resizable(width=False, height=False)

        self.frame = mtTkinter.Frame(self.root, relief=mtTkinter.FLAT, bd=1)
        self.frame.grid(row=0, column=0, padx=2, pady=2, sticky=mtTkinter.N + mtTkinter.W + mtTkinter.E)
        self.frame.columnconfigure(0, weight=1)

        self.listbox = mtTkinter.Listbox(self.frame, width=100, height=15)
        self.listbox.grid(row=1,column=0, sticky="ew", padx=2, pady=2)
        # listbox scrollbar
        self.listboxScrollbar = mtTkinter.Scrollbar(self.frame, orient="vertical")
        self.listboxScrollbar.grid(row=1, column=1, padx=2,pady=2,sticky="ns")
        self.listboxScrollbar.config(command=self.listbox.yview)
        self.listbox.config(yscrollcommand=self.listboxScrollbar.set)

        #create log textbox
        self.log = mtTkinter.Text(self.frame, height=15, width=100)
        self.log.grid(row=2, column=0, sticky="ew", padx=2, pady=2)
        self.log.config(state=mtTkinter.DISABLED)
        # log scrollbar
        self.logScrollbar = mtTkinter.Scrollbar(self.frame, orient="vertical")
        self.logScrollbar.grid(row=2, column=1, padx=2, pady=2, sticky="ns")
        self.logScrollbar.config(command=self.log.yview)
        self.log.config(yscrollcommand=self.logScrollbar.set)

        # update list button
        self.commandButton = mtTkinter.Button(self.frame, text="update connections list", command=self.update_connection_list)
        self.commandButton.grid(row=3, column=0, sticky="ew")

        self.openStatsWin = {}

        self.update_connection_list()
        self.log.delete("1.0", mtTkinter.END)

        self.listbox.bind("<Double-Button-1>", self.clicked_on_ip)

        self.root.protocol("WM_DELETE_WINDOW", self.exit)

        self.root.mainloop()
Exemple #27
0
 def __init__(self, master):
     self.master = master
     #基准界面initface
     self.initface = tk.Canvas(self.master,
                               bg="white",
                               width=winwidth,
                               height=winheight)
     self.initface.pack()
     self.initface.configure(highlightthickness=0)
     #常量定义
     self.closebtnwidth = 70  #关闭按钮的大小
     self.Bigbtnwidth = winwidth / 3  #中央大按钮的大小
     self.btnwidth = winheight / 4  #普通按钮的大小
     self.padding1 = 40  #普通按钮之间的间隔
     self.midlength = winwidth * 9 / 24
     self.sidelength = winwidth * 15 / 48
     self.tomid = 50
     self.Amovex = winwidth / 3 - self.padding1 - self.btnwidth - self.tomid
     self.Bmovey = winheight / 4
     self.Cmovex = winwidth * 2 / 3 + self.padding1 + self.tomid
     self.midmove = 60  #中间层按钮偏移量
     self.heartratelist = [80, 90, 69, 110, 102, 79]  #心跳速度列表
     self.oxygenlist = [89, 90, 98, 96, 87, 92]  #血氧浓度列表
     #偏移量
     self.move = [
         [self.Amovex, self.Bmovey - self.btnwidth / 2 - self.padding1 / 2],
         [
             self.Amovex - self.midmove,
             self.Bmovey + self.btnwidth / 2 + self.padding1 / 2
         ],
         [
             self.Amovex,
             self.Bmovey + self.btnwidth * 3 / 2 + self.padding1 * 3 / 2
         ], [winwidth / 3, 0], [winwidth / 3, self.Bmovey],
         [self.sidelength, winheight * 5 / 6],
         [self.Cmovex, self.Bmovey - self.btnwidth / 2 - self.padding1 / 2],
         [
             self.Cmovex + self.midmove,
             self.Bmovey + self.btnwidth / 2 + self.padding1 / 2
         ],
         [
             self.Cmovex,
             self.Bmovey + self.btnwidth * 3 / 2 + self.padding1 * 3 / 2
         ]
     ]
     #读取图片
     self.titleimage = ImageTk.PhotoImage(
         Image.open("srcimage/title.jpg").resize(
             (int(winwidth / 3), int(winheight / 6))))
     self.backgroundimage = ImageTk.PhotoImage(
         Image.open("srcimage/background.jpg").resize(
             (int(winwidth), int(winheight))))
     self.bookimage = ImageTk.PhotoImage(
         Image.open("srcimage/photos.jpg").resize(
             (int(self.btnwidth), int(self.btnwidth))))
     self.movieimage = ImageTk.PhotoImage(
         Image.open("srcimage/video.jpg").resize(
             (int(self.btnwidth), int(self.btnwidth))))
     self.musicimage = ImageTk.PhotoImage(
         Image.open("srcimage/music.jpg").resize(
             (int(self.btnwidth), int(self.btnwidth))))
     self.studyimage = ImageTk.PhotoImage(
         Image.open("srcimage/emecall.jpg").resize(
             (int(self.btnwidth), int(self.btnwidth))))
     self.gameimage = ImageTk.PhotoImage(
         Image.open("srcimage/phone.jpg").resize(
             (int(self.btnwidth), int(self.btnwidth))))
     self.hearto2image = ImageTk.PhotoImage(
         Image.open("srcimage/hearto2.jpg").resize(
             (int(self.btnwidth), int(self.btnwidth))))
     self.workimage = ImageTk.PhotoImage(
         Image.open("srcimage/looking.jpg").resize(
             (int(self.Bigbtnwidth), int(self.Bigbtnwidth))))
     self.closeimage = ImageTk.PhotoImage(
         Image.open("srcimage/close.jpg").resize(
             (int(self.closebtnwidth), int(self.closebtnwidth))))
     # 右边的三个按钮
     self.buttonA_1 = tk.Button(self.initface,
                                image=self.bookimage,
                                height=self.btnwidth,
                                width=self.btnwidth,
                                relief="ridge",
                                command=self.gotophoto,
                                bd=0)
     self.buttonA_1.place(x=self.move[0][0], y=self.move[0][1])
     self.buttonA_2 = tk.Button(self.initface,
                                image=self.movieimage,
                                height=self.btnwidth,
                                width=self.btnwidth,
                                relief="ridge",
                                command=self.gotovideo,
                                bd=0)
     self.buttonA_2.place(x=self.move[1][0], y=self.move[1][1])
     self.buttonA_3 = tk.Button(self.initface,
                                image=self.musicimage,
                                height=self.btnwidth,
                                width=self.btnwidth,
                                relief="ridge",
                                command=self.gotomusic,
                                bd=0)
     self.buttonA_3.place(x=self.move[2][0], y=self.move[2][1])
     # 交大的校徽
     self.titleCanvas = tk.Canvas(self.initface,
                                  width=self.Bigbtnwidth,
                                  height=winheight / 6)
     self.titleCanvas.place(x=self.move[3][0], y=self.move[3][1])
     self.titleCanvas.create_image(0, 0, anchor='nw', image=self.titleimage)
     self.titleCanvas.configure(highlightthickness=0)
     # 中间的按钮
     self.buttonB = tk.Button(self.initface,
                              image=self.workimage,
                              height=int(winheight / 2),
                              width=int(winwidth / 3),
                              relief="ridge")
     self.buttonB.place(x=self.move[4][0], y=self.move[4][1])
     # 左边的三个按钮
     self.buttonC_1 = tk.Button(self.initface,
                                image=self.studyimage,
                                height=self.btnwidth,
                                width=self.btnwidth,
                                relief="ridge",
                                command=self.emecall,
                                bd=0)
     self.buttonC_1.place(x=self.move[6][0], y=self.move[6][1])
     self.buttonC_2 = tk.Button(self.initface,
                                image=self.gameimage,
                                height=self.btnwidth,
                                width=self.btnwidth,
                                relief="ridge",
                                command=self.callfamily,
                                bd=0)
     self.buttonC_2.place(x=self.move[7][0], y=self.move[7][1])
     self.buttonC_3 = tk.Button(self.initface,
                                image=self.hearto2image,
                                height=self.btnwidth,
                                width=self.btnwidth,
                                relief="ridge",
                                bd=0,
                                command=self.gotoheartpage)
     self.buttonC_3.place(x=self.move[8][0], y=self.move[8][1])
     #关闭按钮
     self.closebtn = tk.Button(self.initface,
                               image=self.closeimage,
                               width=self.closebtnwidth,
                               height=self.closebtnwidth,
                               bd=0,
                               command=self.destroypage)
     self.closebtn.place(x=winwidth - self.closebtnwidth, y=0)
     self.hearto2page = []
     #刷新显示图片
     self.showtitle()
Exemple #28
0
 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()
Exemple #29
0
    def __createGUI(self):
        self.root = mtk.Tk()
        self.root.title("移动惠购用户查询工具")
        self.root.geometry("720x600")

        self.settings = mtk.LabelFrame(text="设置", fg="blue")
        self.settings.place(x=50, y=20, width=600, height=130)

        self.shopId = mtk.Label(self.settings, text="店铺  ID:")
        self.shopId.place(x=30, y=10, width=60, height=20)
        self.shopIdText = mtk.Entry(self.settings)
        self.shopIdText.place(x=85, y=10, width=80, height=20)

        self.workNo = mtk.Label(self.settings, text="工   号:")
        self.workNo.place(x=200, y=10, width=60, height=20)
        self.workNoText = mtk.Entry(self.settings)
        self.workNoText.place(x=260, y=10, width=80, height=20)

        self.semaphoreNum = mtk.Label(self.settings, text="并发数量:")
        self.semaphoreNum.place(x=30, y=70, width=60, height=20)
        self.entrySemaphoreNum = mtk.Entry(self.settings)
        self.entrySemaphoreNum.place(x=85, y=70, width=80, height=20)

        self.timeSleep = mtk.Label(self.settings, text="延迟时间:")
        self.timeSleep.place(x=200, y=70, width=60, height=20)
        self.entrySleep = mtk.Entry(self.settings)
        self.entrySleep.place(x=260, y=70, width=80, height=20)

        self.statusNow = mtk.Label(self.settings, text="当前进度:")
        self.statusNow.place(x=420, y=10, width=60, height=20)
        self.statusNowText = mtk.Label(self.settings, text="0/0")
        self.statusNowText.place(x=450, y=50, width=60, height=20)

        self.showDataBox = mtk.LabelFrame(self.root, text="数据信息", fg="blue")
        self.showDataBox.place(x=50, y=170, width=400, height=400)
        title = ['1', '2', '3', '4']
        self.box = ttk.Treeview(self.showDataBox,
                                columns=title,
                                show='headings')
        self.box.place(x=20, y=15, width=360, height=340)
        self.box.column('1', width=50, anchor='center')
        self.box.column('2', width=100, anchor='center')
        self.box.column('3', width=50, anchor='center')
        self.box.column('4', width=160, anchor='center')
        self.box.heading('1', text='序号')
        self.box.heading('2', text='手机号')
        self.box.heading('3', text='优惠')
        self.box.heading('4', text='ERROR信息')
        self.VScroll1 = Scrollbar(self.box,
                                  orient='vertical',
                                  command=self.box.yview)
        self.VScroll1.pack(side="right", fill="y")
        self.box.configure(yscrollcommand=self.VScroll1.set)
        self.box.bind(sequence="<Double-Button-1>",
                      func=lambda x: self.thread_it(self.showDetail))

        self.btnBox = mtk.LabelFrame(self.root, text="任务栏", fg="blue")
        self.btnBox.place(x=480, y=170, width=170, height=400)

        self.fileBox = mtk.LabelFrame(self.btnBox)
        self.fileBox.place(x=15, y=30, width=140, height=120)

        self.loadExcel = mtk.Button(
            self.fileBox,
            text="导入Excel",
            command=lambda: self.thread_it(self.__loadExcel))
        self.loadExcel.place(x=15, y=20, width=100, height=30)
        self.btnEnd = mtk.Button(
            self.fileBox,
            text="导出Excel",
            command=lambda: self.thread_it(self.__saveExcel))
        self.btnEnd.place(x=15, y=70, width=100, height=30)

        self.btnBbox = mtk.LabelFrame(self.btnBox)
        self.btnBbox.place(x=15, y=200, width=140, height=120)
        self.btnStart = mtk.Button(self.btnBbox,
                                   text="开始",
                                   command=lambda: self.thread_it(self.start))
        self.btnStart.place(x=15, y=20, width=100, height=30)
        self.btnStop = mtk.Button(self.btnBbox,
                                  text="停止",
                                  command=lambda: self.thread_it(self.stop))
        self.btnStop.place(x=15, y=70, width=100, height=30)
Exemple #30
0
def app():
    # initialise a window.
    root = tk.Tk()
    root.config(background='white')
    root.geometry("1000x700")

    lab = tk.Label(root, text="Sismografo", bg='white').pack()

    fig = Figure()

    ax = fig.add_subplot(111)
    ax.set_xlabel("X axis")
    ax.set_ylabel("Y axis")

    # fig = plt.figure(1)
    # plt.ion()

    graph = FigureCanvasTkAgg(fig, master=root)
    graph.get_tk_widget().pack(side="top", fill='both', expand=True)

    variable = tk.StringVar(root)
    variable.set("3 V   ")  #defaultvalue
    #w=tk.OptionMenu(root, variable,"3 V   ", "1 V   ", "0.3 V   ")
    #w.place(x= 300, y = 672)

    var = tk.StringVar(root)
    var.set("1ms")

    #option = tk.OptionMenu(root, var,"0.1ms", "1ms", "10ms")
    #option.place(x= 600, y = 672)

    def osciloscopio():
        valch1_lower = np.array([], np.dtype(int))
        valch1_upper = np.array([], np.dtype(int))
        valch2_lower = np.array([], np.dtype(int))
        valch2_upper = np.array([], np.dtype(int))
        vald1 = np.array([], np.dtype(int))
        vald2 = np.array([], np.dtype(int))

        data_count = 0
        cnt = 0
        point_count = 0
        #create the serial port object
        port = serial.Serial('/dev/ttyUSB0', 115200, timeout=0.5)

        while continuePlotting:
            #port.write(b's') #handshake with Arduino
            if (port.inWaiting()):  # if the arduino replies
                value = np.array(map(ord, port.read(8000)))  # read the reply
                if cnt == 0:
                    cnt = cnt + 1
                    continue
                data = ''

                first_mask = value[:len(value)] == 255
                index1 = np.flatnonzero(first_mask) + 1
                valch1_upper = value[index1[:-2]]
                index2 = np.array(np.flatnonzero(first_mask)) + 2
                valch1_lower = value[index2[:-2]] & 63
                index3 = np.array(np.flatnonzero(first_mask)) + 3
                valch2_upper = value[index3[:-2]]
                index4 = np.array(np.flatnonzero(first_mask)) + 4
                valch2_lower = value[index4[:-2]] & 63
                end_array = SampleOptions[var.get()]

                makeFig(valch1_lower, valch1_upper, valch2_lower, valch2_upper,
                        ax, graph, variable, var)
                valch1_lower = np.array([], np.dtype(int))
                valch1_upper = np.array([], np.dtype(int))
                valch2_lower = np.array([], np.dtype(int))
                valch2_upper = np.array([], np.dtype(int))

    def gui_handler():
        change_state()
        threading.Thread(target=osciloscopio).start()

    b = tk.Button(root,
                  text="Start/Stop",
                  command=gui_handler,
                  bg="red",
                  fg="white")
    b.place(x=450, y=20)

    b1 = tk.Button(root,
                   text="X",
                   command=change_channel1state,
                   bg="blue",
                   fg="white")
    b1.pack(side="left")

    b2 = tk.Button(root,
                   text="Z",
                   command=change_channel2state,
                   bg="blue",
                   fg="white")
    b2.pack(side="right")

    root.mainloop()