def body(self, master): # create canvas to hold scrollbar and listbox objects emailListCanvas = Canvas(master, width=350, height=400) emailListCanvas.config(scrollregion=emailListCanvas.bbox(ALL)) emailListCanvas.grid(column=0, sticky=W) # create multiListbox to hold email list self._emailListbox = MultiListbox(emailListCanvas, (('Email', 160), ("", 1)), command=self.deleteEmail) for item in self.emailList: self._emailListbox.insert(END, (item, "")) self._emailListbox.grid(column=0, columnspan=3, sticky=W) addButton = Button(emailListCanvas, text="Add", command=self.addEmail) addButton.grid(row=1, column=0) deleteButton = Button(emailListCanvas, text="Delete", command=self.deleteEmail) deleteButton.grid(row=1, column=1) helpButton = Button(emailListCanvas, text="Help", command=self.displayHelp) helpButton.grid(row=1, column=2)
def initUI(self): self.parent.title("Typesetting") self.min_margin = 10 self.max_margin = 100 self.margin_value = self.min_margin self.words = [] menubar = Menu(self.parent) self.parent.config(menu=menubar) fileMenu = Menu(menubar) fileMenu.add_command(label="Open", command=self.openfile) fileMenu.add_command(label="Clear", command=self.clear) fileMenu.add_separator() fileMenu.add_command(label="Exit", command=self.onExit) menubar.add_cascade(label="File", menu=fileMenu) grid = Frame(self.parent) left_grid = Frame(grid) w_list_label = Label(left_grid,text="Lista de palabras") w_list_label.pack(side=TOP) self.w_list = MultiListbox(left_grid,(("Palabra",20),("Longitud",10))) self.w_list.pack(side=BOTTOM,fill=BOTH,expand=TRUE) left_grid.pack(side=LEFT,fill=BOTH,expand=TRUE) right_grid = Frame(grid) up_grid = Frame(right_grid) margin_label = Label(up_grid,text="Margen") margin_label.pack(side=LEFT,expand=TRUE) self.margin_scale = Scale(up_grid,orient=HORIZONTAL,showvalue=0,\ variable=self.margin_value,from_=self.min_margin,to=self.max_margin, command=self.refresh_margin) self.margin_scale.pack(side=LEFT) self.margin_spinbox = Spinbox(up_grid,\ textvariable=self.margin_value,from_=self.min_margin,to=self.max_margin) self.margin_spinbox.pack(side=LEFT) typeset_btn = Button(up_grid, text ="Typeset", command =self.typeset) typeset_btn.pack(side=RIGHT) up_grid.pack(side=TOP) self.text = Text(right_grid) self.text.pack(side=BOTTOM,fill=BOTH,expand=TRUE) right_grid.pack(side=RIGHT,fill=BOTH) grid.pack(fill=BOTH, expand=YES)
def create_main_frame(self): self.main_labelframe = LabelFrame(self, text='消息中心') self.main_list_item = (('业务编号', 10), ('客户编号', 8), ('客户名称', 20), ('发放日', 10), ('到期日', 10), ('贷款金额', 5), ('产品名称', 10), ('期限', 5), ('利率', 8), ('申请状态', 14)) self.main_list = MultiListbox(self.main_labelframe, self.main_list_item, height=22) self.main_list.grid(padx=10, pady=10, row=0, column=0) self.check_button = Button(self.main_labelframe, text='察看') def check_func(): apply_information = self.get_mutilistbox_choose() if not apply_information: MessageBox('当前申请', '请先选中一个申请消息') return self.apply_information_toplevel = ApplyInformationToplevel( self, apply_information) self.check_button['command'] = check_func self.check_button.grid(pady=10, row=1, column=0)
def create_mutilistbox(self, mutilistbox_items): self.people_mutilistbox = MultiListbox(self, mutilistbox_items) self.people_mutilistbox['width'] = 200 self.people_mutilistbox['height'] = 100 self.refresh_mutilistbox()