Beispiel #1
0
    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)
Beispiel #2
0
 def create_frame(self):
     self.tabcontrol = ttk.Notebook(self.root)
     self.tabcontrol.pack(fill="both", expand=1)
     self.eeg_tab = pytk.PyFrame(self.tabcontrol)  #脑电
     self.ecg_tab = pytk.PyFrame(self.tabcontrol)  #心电
     self.gsr_tab = pytk.PyFrame(self.tabcontrol)  #皮肤电
     self.tabcontrol.add(self.eeg_tab, text="脑电信号可视化")
     self.tabcontrol.add(self.ecg_tab, text="心电信号可视化")
     self.tabcontrol.add(self.gsr_tab, text="皮肤电信号可视化")
     self.tabcontrol.select(self.eeg_tab)
     #将每种数据的tab页分成左右两个部分,左边是设置及状态
     #右边是对应数据波形
     self.creat_eeg_frame()
     self.creat_ecg_frame()
     self.creat_gsr_frame()
Beispiel #3
0
    def creat_eeg_frame_left_top(self):

        self.eeg_frm_l_label = pytk.PyLabel(self.eeg_frame_left_top,
                                            text="Serial Ports",
                                            font=g_font,
                                            anchor="w")
        self.eeg_frm_l_listbox = pytk.PyListbox(self.eeg_frame_left_top,
                                                font=g_font)
        self.eeg_left_serial_set = pytk.PyLabelFrame(self.eeg_frame_left_top)
        self.eeg_left_btn = pytk.PyButton(self.eeg_frame_left_top,
                                          text="Open",
                                          font=g_font,
                                          command=self.Toggle)

        self.eeg_frm_l_label.pack(fill="both", expand=0, padx=5, pady=5)
        self.eeg_frm_l_listbox.pack(fill="both", expand=1, padx=5, pady=5)
        self.eeg_left_serial_set.pack(fill="both", expand=0, padx=5, pady=5)
        self.eeg_left_btn.pack(fill="both", expand=0, padx=5, pady=10)
        self.eeg_frm_l_listbox.bind("<Double-Button-1>", self.open)

        eeg_baudrate_list = ["9600", "38400", "57600", "115200"]

        self.eeg_frm_left_left = pytk.PyFrame(
            self.eeg_left_serial_set)  #左边区域显示标签
        self.eeg_frm_left_right = pytk.PyFrame(
            self.eeg_left_serial_set)  #右边区域显示波特率
        self.eeg_frm_left_left.pack(fill="both", expand=1, side=tk.LEFT)
        self.eeg_frm_left_right.pack(fill="both", expand=1, side=tk.RIGHT)

        self.eeg_frm_left_label_temp = pytk.PyLabel(self.eeg_frm_left_left,
                                                    text="Baudrate:",
                                                    font=g_font)
        self.eeg_frm_left_label_temp.pack(fill="both",
                                          expand=1,
                                          padx=5,
                                          pady=5)

        self.eeg_frm_left_combobox_baudrate = ttk.Combobox(
            self.eeg_frm_left_right,
            width=10,
            font=g_font,
            values=eeg_baudrate_list)
        self.eeg_frm_left_combobox_baudrate.pack(fill="both",
                                                 expand=1,
                                                 padx=5,
                                                 pady=5)
        self.eeg_frm_left_combobox_baudrate.current(2)
Beispiel #4
0
    def create_frame(self):
        '''
        创建窗体,分为上下2个部分,下半部分为状态栏
        '''
        self.frm = pytk.PyFrame(self.root)

        self.frm_top = pytk.PyLabelFrame(self.frm)
        self.frm_status = pytk.PyLabelFrame(self.frm)

        self.frm_top.pack(fill="both", expand=1)
        self.frm_status.pack(fill="both", expand=0)

        self.create_frm_top()
        self.create_frm_status()
Beispiel #5
0
    def create_frm_left_serial_set(self):
        '''
        串口配置,比如波特率,奇偶校验等
        '''
        setting_label_list = [
            "BaudRate :", "Parity :", "DataBit :", "StopBit :"
        ]
        baudrate_list = [
            "1200", "2400", "4800", "9600", "14400", "19200", "38400", "43000",
            "57600", "76800", "115200"
        ]
        # PARITY_NONE, PARITY_EVEN, PARITY_ODD PARITY_MARK, PARITY_SPACE
        parity_list = ["N", "E", "O", "M", "S"]
        bytesize_list = ["5", "6", "7", "8"]
        stopbits_list = ["1", "1.5", "2"]

        self.frm_left_left = pytk.PyFrame(self.frm_left_serial_set)
        self.frm_left_right = pytk.PyFrame(self.frm_left_serial_set)
        self.frm_left_left.pack(fill="both", expand=1, side=tk.LEFT)
        self.frm_left_right.pack(fill="both", expand=1, side=tk.RIGHT)

        for item in setting_label_list:
            frm_left_label_temp = pytk.PyLabel(self.frm_left_left,
                                               text=item,
                                               font=g_font)
            frm_left_label_temp.pack(fill="both", expand=1, padx=5, pady=5)

        self.frm_left_combobox_baudrate = ttk.Combobox(self.frm_left_right,
                                                       width=15,
                                                       font=g_font,
                                                       values=baudrate_list)
        self.frm_left_combobox_parity = ttk.Combobox(self.frm_left_right,
                                                     width=15,
                                                     font=g_font,
                                                     values=parity_list)
        self.frm_left_combobox_databit = ttk.Combobox(self.frm_left_right,
                                                      width=15,
                                                      font=g_font,
                                                      values=bytesize_list)
        self.frm_left_combobox_stopbit = ttk.Combobox(self.frm_left_right,
                                                      width=15,
                                                      font=g_font,
                                                      values=stopbits_list)
        self.frm_left_combobox_baudrate.pack(fill="both",
                                             expand=1,
                                             padx=5,
                                             pady=5)
        self.frm_left_combobox_parity.pack(fill="both",
                                           expand=1,
                                           padx=5,
                                           pady=5)
        self.frm_left_combobox_databit.pack(fill="both",
                                            expand=1,
                                            padx=5,
                                            pady=5)
        self.frm_left_combobox_stopbit.pack(fill="both",
                                            expand=1,
                                            padx=5,
                                            pady=5)

        self.frm_left_combobox_baudrate.current(10)
        self.frm_left_combobox_parity.current(0)
        self.frm_left_combobox_databit.current(3)
        self.frm_left_combobox_stopbit.current(0)
Beispiel #6
0
    def create_frame(self):
        '''
        创建窗体
        '''
        self.frm = pytk.PyFrame(self.root)
        self.frm.pack(fill="both", expand=1)

        self.import_listbox = pytk.PyListbox(self.frm,
                                             font=g_font,
                                             selectmode='extended',
                                             width=30)
        self.import_listbox.grid(column=0,
                                 row=0,
                                 rowspan=2,
                                 sticky=tk.N + tk.S,
                                 padx=5,
                                 pady=5)
        #self.import_listbox.insert(0,'text')

        self.add_btn = pytk.PyButton(self.frm,
                                     font=g_font,
                                     text='>>',
                                     command=self.add_codes)
        self.add_btn.grid(column=1, row=0, sticky=tk.S, padx=5, pady=5)

        self.del_btn = pytk.PyButton(self.frm,
                                     font=g_font,
                                     text='<<',
                                     command=self.del_codes)
        self.del_btn.grid(column=1, row=1, sticky=tk.N, padx=5, pady=5)

        self.code_listbox = pytk.PyListbox(self.frm,
                                           font=g_font,
                                           selectmode='extended',
                                           width=30,
                                           fg="red")
        self.code_listbox.grid(column=2,
                               row=0,
                               rowspan=2,
                               sticky=tk.N + tk.S,
                               padx=5,
                               pady=5)

        self.preview_canvas = pytk.PyCanvas(self.frm, width=200, height=200)
        self.preview_canvas.grid(column=3, row=0, rowspan=2, padx=5, pady=5)

        self.gen_codes_btn = pytk.PyButton(self.frm,
                                           text='生成CODE128',
                                           command=self.gen_codes)
        self.gen_codes_btn.grid(column=2,
                                row=2,
                                padx=5,
                                pady=5,
                                sticky=tk.N + tk.S + tk.E + tk.W)

        self.frm_file = pytk.PyLabelFrame(self.frm)
        self.frm_file.grid(column=0,
                           row=2,
                           columnspan=2,
                           padx=5,
                           pady=5,
                           sticky=tk.N + tk.S + tk.E + tk.W)
        self.create_frm_file()

        self.frm_setting = pytk.PyLabelFrame(self.frm)
        self.frm_setting.grid(column=3,
                              row=2,
                              padx=5,
                              pady=5,
                              sticky=tk.N + tk.S + tk.E + tk.W)
        self.create_frm_setting()

        self.progressbar = ttk.Progressbar(self.frm, value=0)
        self.progressbar.grid(column=0,
                              row=3,
                              columnspan=4,
                              padx=5,
                              pady=5,
                              sticky=tk.N + tk.S + tk.E + tk.W)