Exemple #1
0
    def refresh(self):
        self.frame_main.forget()
        del self.frame_main

        self.bottom.forget()
        del self.bottom

        self.frame_main = tk.Frame(self.root, bg="white", bd=2)
        self.frame_main.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH)

        self.bottom = tk.Frame(self.root, width=5, bg="blue")
        self.bottom.pack(side=tk.LEFT, fill=tk.Y)

        ft = tkFont.Font(family="微软雅黑", size=12, weight=tkFont.BOLD)
        all_code = self.controls.get(0.0, tk.END)
        len_color = len(colors) - 1
        all_error = ""
        for i, one in enumerate(all_code.split("\n")):
            if one is not None and one.strip() != "":
                color = colors[i % len_color]
                desc = one.split(".")[0]
                pack = one.split(".")[1:][0]
                pack_code = "tk.Label(self.frame_main, font=ft, text='{}', width=10, height=3, bg='{}')".format(
                    desc, color)
                pack_code += "." + pack
                try:
                    exec(pack_code)
                except Exception as err:
                    print(pack_code)
                    all_error += one + "\n"
        if all_error != "":
            message = "以下布局设置语法有错误,请检查:\n\n"
            message += all_error
            tku.show_info(message)
Exemple #2
0
 def body(self):
     all_code = self.pack_code
     len_color = len(colors) - 1
     all_error = ""
     ft = tkFont.Font(family="微软雅黑", size=12, weight=tkFont.BOLD)
     for i, one in enumerate(all_code.split("\n")):
         if one is not None and one.strip() != "":
             color = colors[i % len_color]
             desc = one.split(".")[0]
             pack = one.split(".")[1:][0]
             pack_code = "tk.Label(self.root, font=ft, text='{}', width=10, height=3, bg='{}')".format(
                 desc, color)
             pack_code += "." + pack
             try:
                 exec(pack_code)
             except Exception as err:
                 all_error += one + "\n"
     if all_error != "":
         message = "以下布局设置语法有错误,请检查:\n\n"
         message += all_error
         tku.show_info(message)
Exemple #3
0
 def _onclick_ele_open_close_button(ele_num=0, open_=0):
     flag = 0
     if ele.ele_set[ele_num]["state"] == State.STOP and ele.ele_set[
             ele_num]["direction"] == Direction.STOP:
         flag = 1
     if ele.ele_set[ele_num]["state"] == State.STOP and ele.ele_set[
             ele_num]["direction"] == Direction.UP:
         flag = 1
         ele.ele_set[ele_num]["stay"] = True
     if ele.ele_set[ele_num]["state"] == State.STOP and ele.ele_set[
             ele_num]["direction"] == Direction.DOWN:
         flag = 1
         ele.ele_set[ele_num]["stay"] = True
     if flag == 1:
         if open_ == 0:
             ele.ele_set[ele_num]["open"] = False
         if open_ == 1:
             ele.ele_set[ele_num]["open"] = True
     else:
         if open_ == 0:
             tkui.show_info("门已经关上了!")
         if open_ == 1:
             tkui.show_info("只有在停止的时候才能开门哦!")
Exemple #4
0
 def _onclick_ele_alarm_button():
     tkui.show_info("已报警!")