Exemple #1
0
    def _init_widgets(self):
        self.profession_selector = ProfessionSelector(self, self.updating_request_profession)
        self.profession_selector.place(x=5, y=5)
        self.rank_selector = RankSelector(self, self.updating_request_rank)
        self.rank_selector.place(x=5, y=53)

        Label(self, text='所屬', width=5, font=("", 10)).place(x=221, y=5)
        self.belonged_selector = FilteredCombobox(self, width=7, font=("", 11), justify=CENTER)
        self.belonged_selector['values'] = BELONGEDS
        self.belonged_selector.place(x=213, y=22)
        self.belonged_selector.bind('<<ComboboxSelected>>',
                                    lambda x: self.updating_request_belonged(self.belonged_selector.get()))
        self.belonged_selector.bind('<Return>', lambda x: self.character_selector.focus_set())

        Label(self, text='篩選', width=5, font=("", 11)).place(x=222, y=54)
        self.name_request = StringVar(value='')
        entry = Entry(self, width=8, textvariable=self.name_request, font=("", 12))
        entry.place(x=214, y=73)
        entry.bind('<Return>', lambda x: self.updating_request_name())
        entry.bind('<Escape>', lambda x: (self.name_request.set(''), self.updating_request_name()))

        Label(self, text='Character', width=10, font=("", 12)).place(x=304, y=26)
        self.character_selector = ttk.Combobox(self, state='readonly', width=10, font=("", 12), justify=CENTER)
        self.character_selector.place(x=305, y=48)
        self.character_selector.bind('<Return>', lambda x: self.submitting())

        # 熱鍵,直接指過來
        self.bind('<f>', lambda x: self.character_selector.focus_set())

        y_position = 115
        # 送交的按鈕
        button = Button(self, text="選擇此角色", width=25, borderwidth=3)
        button.place(x=17, y=y_position)
        button["command"] = self.submitting

        # 新增角色的按鈕
        button = Button(self, text="新增角色", width=9, borderwidth=3)
        button.place(x=225, y=y_position)
        button["command"] = lambda: open_adding_new_jp_character_window(
            self, lambda new_character: (self.update_records(), self.updating_character_selector()))

        # 取消並結束的按鈕
        button = Button(self, text="放棄選擇", width=9, borderwidth=3)
        button.place(x=317, y=y_position)
        button["command"] = self.destroy
    def _init_upper_frame(self):
        filter_frame = Frame(self, width=self['width'], height=40)
        filter_frame.place(x=0, y=0)

        current_x = 45
        self.profession_selector = ProfessionSelector(filter_frame,
                                                      self.updating_profession)
        self.profession_selector.place(x=current_x, y=-4)

        current_x += 199
        self.rank_selector = RankSelector(filter_frame, self.updating_rank)
        self.rank_selector.place(x=current_x, y=-4)

        # 所屬篩選
        current_x = 448
        Label(filter_frame, text='所屬:',
              font=(MS_JH, 10)).place(x=current_x + 10, y=-3)
        self.belonged = FilteredCombobox(filter_frame, width=6, justify=CENTER)
        self.belonged['values'] = BELONGEDS
        self.belonged.place(x=current_x, y=16)
        self.belonged.bind('<<ComboboxSelected>>',
                           lambda event: self.updating_belonged())

        # 角色部分名稱篩選
        current_x += 75
        Label(filter_frame, text='篩選:', font=(MS_JH, 12)).place(x=current_x,
                                                                y=7)
        self.request = StringVar()
        entry = Entry(filter_frame,
                      width=9,
                      textvariable=self.request,
                      font=(MS_JH, 11))
        entry.place(x=current_x + 42, y=9)
        entry.bind('<Return>', lambda event: self.update_table())

        # 清空進行篩選的條件
        button = Button(filter_frame, text="清空條件", width=7, font=(MS_JH, 11))
        button.place(x=667, y=3)
        button["command"] = self.clearing_filters