def create_frm_right_send(self): ''' 2、Entry显示(发送的数据)用64个Entry来显示 ''' self.entry_list = list() line_frm_1 = pytk.PyFrame(self.frm_right_send) line_frm_2 = pytk.PyFrame(self.frm_right_send) line_frm_3 = pytk.PyFrame(self.frm_right_send) line_frm_4 = pytk.PyFrame(self.frm_right_send) line_frm_1.pack(fill="both", expand=1, pady=1) line_frm_2.pack(fill="both", expand=1, pady=1) line_frm_3.pack(fill="both", expand=1, pady=1) line_frm_4.pack(fill="both", expand=1, pady=1) for i in range(64): temp_str = tk.StringVar() if i // 16 == 0: master = line_frm_1 elif i // 16 == 1: master = line_frm_2 elif i // 16 == 2: master = line_frm_3 elif i // 16 == 3: master = line_frm_4 temp_entry = pytk.PyEntry(master, textvariable=temp_str, width=3, fg="#1E90FF", font=g_font) temp_str.set("00") temp_entry.pack(fill="both", expand=1, padx=1, side=tk.LEFT) self.entry_list.append(temp_str)
def create_frm_right_clear(self): ''' 3、Label显示和清除接收信息按钮 ''' self.checkValue = tk.IntVar() self.frm_right_clear_label = pytk.PyLabel(self.frm_right_clear, text="Data Received", anchor="w", font=g_font) self.frm_right_threshold_label = pytk.PyLabel(self.frm_right_clear, text="Threshold:", font=g_font) self.threshold_str = tk.StringVar() self.frm_right_threshold_entry = pytk.PyEntry( self.frm_right_clear, textvariable=self.threshold_str, width=6, font=g_font) self.receive_hex_cbtn_var = tk.IntVar() self.frm_right_hex_checkbtn = pytk.PyCheckbutton( self.frm_right_clear, text="Hex", variable=self.receive_hex_cbtn_var, relief="flat", font=g_font) self.frm_right_clear_btn = pytk.PyButton(self.frm_right_clear, text="Clear", width=10, font=g_font) self.frm_right_clear_label.pack(fill="both", expand=1, padx=5, pady=5, side=tk.LEFT) self.frm_right_threshold_label.pack(fill="both", expand=0, padx=5, pady=5, side=tk.LEFT) self.frm_right_threshold_entry.pack(fill="both", expand=0, padx=5, pady=5, side=tk.LEFT) self.frm_right_hex_checkbtn.pack(fill="both", expand=0, padx=5, pady=5, side=tk.LEFT) self.frm_right_clear_btn.pack(fill="both", expand=0, padx=5, pady=5, side=tk.RIGHT)
def create_frm_right_clear(self): ''' 3、Label显示和十六进制显示和清除接收信息按钮 ''' self.receive_hex_cbtn_var = tk.IntVar() self.frm_right_clear_label = pytk.PyLabel( self.frm_right_clear, text="Data Received" + " " * size_dict["clear_label_width"], font=font) self.frm_right_threshold_label = pytk.PyLabel(self.frm_right_clear, text="Threshold:", font=font) self.thresholdStr = tk.StringVar() self.frm_right_threshold_entry = pytk.PyEntry( self.frm_right_clear, textvariable=self.thresholdStr, width=6, font=font) self.frm_right_hex_checkbtn = pytk.PyCheckbutton( self.frm_right_clear, text="Hex", variable=self.receive_hex_cbtn_var, relief="flat", font=font) self.frm_right_clear_btn = pytk.PyButton(self.frm_right_clear, text="Clear", width=10, font=font, command=self.Clear) self.frm_right_clear_label.grid(row=0, column=0, padx=5, pady=5, sticky="w") self.frm_right_threshold_label.grid(row=0, column=1, padx=5, pady=5, sticky="wesn") self.frm_right_threshold_entry.grid(row=0, column=2, padx=5, pady=5, sticky="wesn") self.frm_right_hex_checkbtn.grid(row=0, column=3, padx=5, pady=5, sticky="wesn") self.frm_right_clear_btn.grid(row=0, column=4, padx=5, pady=5, sticky="wesn") self.thresholdStr.set(1) self.thresholdStr.trace('w', self.GetThresholdValue)
def create_frm_down_entry(self): self.frm_down_entrylabel = pytk.PyLabel(self.frm_down, text="One time(ms)", font=('Monaco', 12)) self.frm_down_entrylabel.pack(expand="yes", fill="both", padx=5, pady=5) default_val = tk.StringVar() default_val.set("5000") self.frm_down_entry = pytk.PyEntry(self.frm_down, textvariable=default_val) self.frm_down_entry.pack(expand="yes", fill="both", padx=5, pady=5)
def create_frm_file(self): self.import_files_entry = pytk.PyEntry(self.frm_file, font=g_font) self.import_files_entry.grid(column=0, row=0, padx=5, pady=5) self.import_files_btn = pytk.PyButton(self.frm_file, font=g_font, text='导入文件', command=self.import_files) self.import_files_btn.grid(column=1, row=0, padx=5, pady=5) self.export_files_entry = pytk.PyEntry(self.frm_file, font=g_font) self.export_files_entry.grid(column=0, row=1, padx=5, pady=5) self.export_files_entry.insert(0, './image') self.export_files_btn = pytk.PyButton(self.frm_file, font=g_font, text='导出目录', command=self.export_files) self.export_files_btn.grid(column=1, row=1, sticky=tk.N, padx=5, pady=5) pass
def create_frm_setting(self): self.setting_width_label = pytk.PyLabel(self.frm_setting, font=g_font, text="宽度:") self.setting_width_label.grid(column=0, row=0, padx=5, pady=5) self.setting_width_label = pytk.PyLabel(self.frm_setting, font=g_font, width=5, text="880") self.setting_width_label.grid(column=1, row=0, padx=5, pady=5) self.setting_height_label = pytk.PyLabel(self.frm_setting, font=g_font, text="高度:") self.setting_height_label.grid(column=0, row=1, padx=5, pady=5) self.setting_height_entry = pytk.PyEntry(self.frm_setting, font=g_font, width=5) self.setting_height_entry.grid(column=1, row=1, padx=5, pady=5) self.setting_height_entry.insert(0, '1000') pass
def create_frm_rr(self): ''' Listbox显示可选路线 Button分别为设定路线和启动 ''' self.frm_rr_road = pytk.PyLabelFrame(self.frm_rr) self.frm_rr_btn = pytk.PyLabelFrame(self.frm_rr) self.frm_rr_set = pytk.PyLabelFrame(self.frm_rr) self.frm_rr_road.pack(fill="both", expand=1, padx=2, pady=5, side=tk.TOP) self.frm_rr_btn.pack(fill="both", expand=0, padx=2, pady=5, side=tk.TOP) self.frm_rr_set.pack(fill="both", expand=0, padx=2, pady=5, side=tk.TOP) self.frm_rr_roadfile_list = pytk.PyListbox(self.frm_rr_road, font=g_font) self.frm_rr_road_addBtn = pytk.PyButton(self.frm_rr_road, text=">>", font=g_font, command=self.AddRoad) self.frm_rr_road_delBtn = pytk.PyButton(self.frm_rr_road, text="<<", font=g_font, command=self.DelRoad) self.frm_rr_road_list = pytk.PyListbox(self.frm_rr_road, font=g_font) self.frm_rr_roadfile_list.pack(fill="both", expand=1, padx=5, pady=5, side=tk.LEFT) self.frm_rr_road_addBtn.pack(fill="none", expand=1, padx=5, pady=5, side=tk.LEFT) self.frm_rr_road_delBtn.pack(fill="none", expand=1, padx=5, pady=5, side=tk.LEFT) self.frm_rr_road_list.pack(fill="both", expand=1, padx=5, pady=5, side=tk.LEFT) self.frm_rr_sendroad_btn = pytk.PyButton(self.frm_rr_btn, text="发送路线", font=g_font, command=self.SendRoadInfo) self.frm_rr_start_btn = pytk.PyButton(self.frm_rr_btn, text=" 启动 ", font=g_font, command=self.SendStart) self.frm_rr_sendroad_btn.pack(fill="both", expand=1, padx=5, pady=5, side=tk.LEFT) self.frm_rr_start_btn.pack(fill="both", expand=1, padx=5, pady=5, side=tk.LEFT) self.frm_rr_entry = pytk.PyEntry(self.frm_rr_set, font=g_font) self.frm_rr_entry.insert(0, '0') self.frm_rr_set_btn = pytk.PyButton(self.frm_rr_set, text="设定起始点", font=g_font, command=self.set_start_point) self.frm_rr_entry.pack(fill="both", expand=1, padx=5, pady=5, side=tk.LEFT) self.frm_rr_set_btn.pack(fill="both", expand=0, padx=5, pady=5, side=tk.LEFT)