def __init__(self, master): frame = tk.Frame(master) frame.pack() tk.Label(frame, text='Remove excel (.xlsx) workbook protection, ' 'worksheet protections and read-only protection' '. \n' '[1] Open password cannot be removed. \n' '[2] .xls and other formats are not supported.', compound=tk.LEFT, bitmap='questhead', wraplength=400, padx=10, justify=tk.LEFT).pack(side=tk.TOP, padx=5) buttom_frame = tk.Frame(frame) buttom_frame.pack(side=tk.TOP, pady=10) self.button_open = tk.Button(buttom_frame, text='Open', fg='black', command=self.open) self.button_open.pack(side=tk.LEFT) self.button_save = tk.Button(buttom_frame, text='Save as', fg='black', state=tk.DISABLED, command=self.save) self.button_save.pack(side=tk.LEFT) self.output = '' self.dirname = '.' self.file_type_opt = { 'defaultextension': '*.xlsx', 'filetypes': (('Excel file', '*.xlsx'), ('All types', '*.*')), }
def __init__(self, parent, oldVal, pname): tk.Toplevel.__init__(self, parent) self.transient(parent) self.parent = parent self.newVal = None self.inputFrame = tk.Frame(self) self.parLabel = tk.Label(self.inputFrame, text="Value for parameter: " + str(pname)) self.parLabel.pack() self.inputVal = tk.StringVar() self.inputVal.set("% g" % oldVal) self.input = tk.Entry(self.inputFrame, textvariable=self.inputVal) self.input.pack() self.inputFrame.pack(fill=tk.X) self.buttonFrame = tk.Frame(self) self.okButton = tk.Button(self, text="OK", command=self._okClicked) self.caButton = tk.Button(self, text="Cancel", command=self._cancelClicked) self.okButton.pack(side=tk.RIGHT) self.caButton.pack(side=tk.LEFT) # Treat return as OK self.bind("<Return>", self._okClicked) # Treat close as cancel self.protocol("WM_DELETE_WINDOW", self._cancelClicked) # For a modal dialog self.grab_set() # Keyboard focus to input entry self.input.focus_set() self.wait_window(self)
def create_widgets(): global list_box, canvas list_box = tkinter.Listbox(root, exportselection=False) list_box.grid(row=0, column=0, rowspan=2, sticky=tkinter.NS) list_box.bind('<<ListboxSelect>>', show_cardset) scroll_bar = tkinter.Scrollbar(root) scroll_bar.grid(row=0, column=1, rowspan=2, sticky=tkinter.NS) list_box.config(yscrollcommand=scroll_bar.set) scroll_bar.config(command=list_box.yview) # create Canvas canvas = tkinter.Canvas(root, width=600, height=600, bg='#5eab6b') canvas.grid(row=0, column=2, sticky=tkinter.NSEW) canvas.bind('<4>', lambda e: canvas.yview_scroll(-5, 'unit')) canvas.bind('<5>', lambda e: canvas.yview_scroll(5, 'unit')) canvas.bind_all("<MouseWheel>", on_mousewheel) scroll_bar = tkinter.Scrollbar(root) scroll_bar.grid(row=0, column=3, sticky=tkinter.NS) canvas.config(yscrollcommand=scroll_bar.set) scroll_bar.config(command=canvas.yview) scroll_bar = tkinter.Scrollbar(root, orient=tkinter.HORIZONTAL) scroll_bar.grid(row=1, column=2, sticky=tkinter.EW) canvas.config(xscrollcommand=scroll_bar.set) scroll_bar.config(command=canvas.xview) # create buttons b_frame = tkinter.Frame(root) b_frame.grid(row=3, column=0, columnspan=4, sticky=tkinter.EW) button = tkinter.Button(b_frame, text='Quit', command=root.destroy, width=8) button.pack(side=tkinter.RIGHT) button = tkinter.Button(b_frame, text='Info', command=show_info, width=8) button.pack(side=tkinter.RIGHT) button = tkinter.Button(b_frame, text='Config', command=show_config, width=8) button.pack(side=tkinter.RIGHT) button = tkinter.Button(b_frame, text='Select Directory', command=select_dir, width=14) button.place(x=200, y=0) root.columnconfigure(2, weight=1) root.rowconfigure(0, weight=1) root.title('Show Cardsets') root.wm_geometry("%dx%d+%d+%d" % (800, 600, 40, 40)) return root
def initPlkActions(self): self.fitbutton = tk.Button(self, text='Fit', command=self.fit) self.fitbutton.grid(row=0, column=0) button = tk.Button(self, text='Reset', command=self.reset) button.grid(row=0, column=1) button = tk.Button(self, text='Write par', command=self.writePar) button.grid(row=0, column=2) button = tk.Button(self, text='Write tim', command=self.writeTim) button.grid(row=0, column=3)
def __init__(self, root): super(Application, self).__init__(root) self.pack() self.hello_button = tkinter.Button(self, text='say hello', command=self.say_hello) self.world_button = tkinter.Button(self, text='say world', command=self.say_world) self.output = scrolledtext.ScrolledText(master=self) self.hello_button.pack(side='top') self.world_button.pack(side='top') self.output.pack(side='top')
def __init__(self, master, cfg): tk.Frame.__init__(self, master) self.master = master self.cfg = cfg columns = ('catalog type', 'path', 'default connection') self.tree = ttk.Treeview(self, columns=columns, selectmode='browse') ysb = ttk.Scrollbar(self, orient='vertical', command=self.tree.yview) xsb = ttk.Scrollbar(self, orient='horizontal', command=self.tree.xview) self.tree.configure(yscroll=ysb.set, xscroll=xsb.set) self.tree.heading('#0', text='name', anchor='w') self.tree.heading('catalog type', text='catalog type', anchor='w') self.tree.heading('path', text='path', anchor='w') self.tree.heading('default connection', text='default connection', anchor='w') self.tree.grid(row=0, column=0, sticky='nsew') ysb.grid(row=0, column=1, sticky='ns') xsb.grid(row=1, column=0, sticky='ew') butbox = tk.Frame(self) butbox.grid(row=0, column=2, sticky='ns') self.newbut = tk.Button(butbox, text='Add', command=self.add) self.newbut.grid(row=0, column=0, sticky='ew') self.removebut = tk.Button(butbox, text='Remove', command=self.remove, state=tk.DISABLED) self.removebut.grid(row=1, column=0, sticky='ew') self.editbut = tk.Button(butbox, text='Edit', command=self.edit, state=tk.DISABLED) self.editbut.grid(row=2, column=0, sticky='ew') self.dupbut = tk.Button(butbox, text='Duplicate', command=self.duplicate, state=tk.DISABLED) self.dupbut.grid(row=3, column=0, sticky='ew') self.rowconfigure(0, weight=1) self.columnconfigure(0, weight=1) self.grid(sticky='nsew') self.tree.bind('<<TreeviewSelect>>', self.selchanged) self.insert_connections()
def __init__(self, parent, opname, interrupt=True, **kwargs): self.maximum = 100 self.toplevel = tk.Toplevel(parent, **kwargs) self.toplevel.title(opname) self.toplevel.transient(parent) self.opname = opname self.count = tk.IntVar() self.label = tk.Label(self.toplevel, text=opname + ' progress: 0%') self.label.pack() self.count.set(-1) self.progress = ttk.Progressbar(self.toplevel, orient='horizontal', mode='determinate', variable=self.count, maximum=self.maximum) self.progress.pack(expand=True, fill=tk.BOTH, side=tk.TOP) self.interrupted = False if interrupt: interrupt_btn = tk.Button(self.toplevel, text='Interrupt', command=self.interrupt) interrupt_btn.pack()
def _Button(self, text, image_file, toggle, frame): if image_file is not None: im = Tk.PhotoImage(master=self, file=image_file) else: im = None if not toggle: b = Tk.Button(master=frame, text=text, padx=2, pady=2, image=im, command=lambda: self._button_click(text)) else: # There is a bug in tkinter included in some python 3.6 versions # that without this variable, produces a "visual" toggling of # other near checkbuttons # https://bugs.python.org/issue29402 # https://bugs.python.org/issue25684 var = Tk.IntVar() b = Tk.Checkbutton(master=frame, text=text, padx=2, pady=2, image=im, indicatoron=False, command=lambda: self._button_click(text), variable=var) b._ntimage = im b.pack(side=Tk.LEFT) return b
def _showNorm(self): """ Shows normalized data in a separate window. """ if self._normalizedDataShown: return self._normwin = tk.Tk() self._normwin.wm_title("Normalized spectrum") self._normwin.protocol("WM_DELETE_WINDOW", self._quitWin) # A frame containing the mpl plot self.normFrame = tk.Frame(master=self._normwin) self.normFrame.pack(fill=tk.BOTH, side=tk.LEFT, expand=True) self.normCanvas = FigureCanvasTkAgg(self.normf, master=self.normFrame) # a tk.DrawingArea self.normCanvas.get_tk_widget().pack() self.normToolbar = NavigationToolbar2TkAgg(self.normCanvas, self.normFrame) self.normToolbar.update() self.normCanvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True) closeButton = tk.Button(master=self._normwin, text='Close', command=self._quitWin) closeButton.pack(side=tk.BOTTOM) self._normalizedDataShown = True self._updateNormalizationPlot()
def _ask_conds(self): # create a child window self.cond_window = Tk.Toplevel() self.entries = self._makeform() Tk.Button(self.cond_window, text="Apply", command=self._consume_entries).pack()
def __init__(self, parent, **kwargs): tk.Frame.__init__(self, parent) self.parent = parent frame_ops = funcs.extract_args(kwargs, FRAME_KEYS, FRAME_KEY) entry_ops = funcs.extract_args(kwargs, ENTRY_KEYS, ENTRY_KEY) button_ops = funcs.extract_args(kwargs, BUTTON_KEYS, BUTTON_KEY) frame = tk.Frame(self, **frame_ops) frame.pack(expand=1, fill=tk.BOTH) tvar = tk.StringVar() if 'text' in kwargs: tvar.set(kwargs['text']) entry = tk.Entry(frame, textvariable=tvar, **entry_ops) button = tk.Button(frame, command=frame.destroy, **button_ops) entry.pack(expand=1, side='left', fill=tk.X) button.pack(expand=1, side='right', fill=tk.X) self.parent.columnconfigure(0, weight=1) self.insert = entry.insert self.delete = entry.delete self.get = entry.get self.set = tvar.set self.index = entry.index self.bind = entry.bind # self.state = lambda: change_state(self.entry) self.enable = lambda: funcs.set_state_normal(entry) self.normal = lambda: funcs.set_state_normal(entry) self.disable = lambda: funcs.set_state_disabled(entry) self.clear = lambda: funcs.clear(entry)
def initLayout(self): button = tk.Button(self, text="Reset TOAs", command=self.resetTimfile) button.grid(row=0, column=0) button = tk.Button(self, text="Remove Changes", command=self.removeChanges) button.grid(row=0, column=1) button = tk.Button(self, text="Apply Changes", command=self.applyChanges) button.grid(row=0, column=2) button = tk.Button(self, text="Write Tim", command=self.writeTim) button.grid(row=0, column=3)
def initLayout(self): button = tk.Button(self, text="Reset Model", command=self.resetParfile) button.grid(row=0, column=0) button = tk.Button(self, text="Remove Changes", command=self.removeChanges) button.grid(row=0, column=1) button = tk.Button(self, text="Apply Changes", command=self.applyChanges) button.grid(row=0, column=2) button = tk.Button(self, text="Write Par", command=self.writePar) button.grid(row=0, column=3)
def __init__(self, root): super(Dashboard, self).__init__(root) self.pack() self.check1butt = tkinter.Button(self, text="Check 1", command=self.check1) self.check1butt.pack(side="top")
def __init__(self, parent, odf): tk.Toplevel.__init__(self, parent) self.wm_title("Value set code") self.parent = parent self.newVal = None self.odf = odf self.showFrame = tk.Frame(self) self.textLabel = tk.Label(self.showFrame, text="Model name: ") self.textLabel.grid(row=0,column=0) self.modelName = tk.StringVar() self.modelName.set("model") self.modelEntry = tk.Entry(self.showFrame, textvariable=self.modelName, width=8) self.modelEntry.bind('<Return>', self._updateModelName) self.modelEntry.grid(row=0,column=1) self.showText = tk.Text(self.showFrame) self.showText.config(background='white') self.showText.grid(row=1,column=0,columnspan=2) #.pack(expand=True) self.clipboardButton = tk.Button(self.showFrame, text="Copy to Clipboard", command=self._copyToClipboard) self.clipboardButton.grid(row=2, column=0, columnspan=2) self.helpLabel = tk.Label(self.showFrame, text="You may use the above code for pasting...") self.helpLabel.grid(row=3, column=0, columnspan=2) self.showFrame.pack() self.protocol("WM_DELETE_WINDOW", self._windowClosed)
def _Button(self, text, file, command, extension='.gif'): img_file = os.path.join(rcParams['datapath'], 'images', file + extension) im = Tk.PhotoImage(master=self, file=img_file) b = Tk.Button( master=self, text=text, padx=2, pady=2, image=im, command=command) b._ntimage = im b.pack(side=Tk.LEFT) return b
def __init__(self, parent, **kwargs): tk.Frame.__init__(self, parent) self.parent = parent frame_ops = funcs.extract_args(kwargs, FRAME_KEYS, FRAME_KEY) entry_ops = funcs.extract_args(kwargs, ENTRY_KEYS, ENTRY_KEY) button_ops = funcs.extract_args(kwargs, BUTTON_KEYS, BUTTON_KEY) scrollbar_ops = funcs.extract_args(kwargs, SCROLLBAR_KEYS, SCROLLBAR_KEY) self.ops = { 'frame': frame_ops, 'entry': entry_ops, 'button': button_ops, 'scrollbar': scrollbar_ops } frame = tk.Frame(self, **frame_ops) frame.grid(sticky='NEWS') button_add_row = tk.Button(frame, command=self.add_row, text='Attach File', **button_ops) button_add_row.grid(row=0, column=0, sticky='NEWS') button_purge_rows = tk.Button(frame, command=self.purge_rows, text='Remove All', **button_ops) button_purge_rows.grid(row=0, column=1, sticky='NEWS') # button_list_rows = tk.Button( # frame, command=self.list_rows, text='List All', # **button_ops # ) # self.button_list_rows.grid( # row=0, column=2, sticky='NEWS' # ) self.wid_list = [] self.row_num = 1 self.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1)
def show_about(self): """ Display an About dialogue box. """ toplevel = tk.Toplevel(self.master, bg='white') toplevel.transient(self.master) toplevel.title('About') tk.Label(toplevel, text='A simple iris viewer', fg='navy', bg='white').pack(pady=20) tk.Label(toplevel, text="Based on Scitools' Iris", bg='white').pack() tk.Button(toplevel, text='Close', command=toplevel.withdraw).pack(pady=30)
def ask_password(master): cancelled = {'cancelled': False} def _do_ok(e=None): tl.destroy() def _do_cancel(e=None): pf.from_string('') cancelled['cancelled'] = True tl.destroy() tl = tk.Toplevel(master) tl.title('iRODS password') tl.transient(master) ff = form.FormFrame(tl) pf = form.PasswordField('password for {}@{}:'.format(user, zone), return_cb=_do_ok) ff.grid_fields([pf]) ff.pack() butbox = tk.Frame(tl) butbox.pack() ok = tk.Button(butbox, text='Ok', command=_do_ok) ok.grid() ok.bind('<Return>', _do_ok) cancel = tk.Button(butbox, text='Cancel', command=_do_cancel) cancel.grid(row=0, column=1) cancel.bind('<Return>', _do_cancel) tl.wait_window() if cancelled['cancelled']: return None scrambled_password = iRODSCatalogBase.encode(pf.to_string()) return iRODSCatalog4.from_options(host, port, user, zone, scrambled_password, default_resc, local_checksum, default_hash_scheme, authentication_scheme, ssl)
def get_widget(self, master): frame = FieldContainer(master) entry = tk.Entry(frame, textvariable=self.var) entry.grid(row=0, column=0, sticky='ew') but = tk.Button(frame, text='browse', command=self.command) but.grid(row=0, column=1) frame.columnconfigure(0, weight=1) return frame
def __init__(self, parent, title, app, **kw): kw = self.initKw(kw) MfxDialog.__init__(self, parent, title, kw.resizable, kw.default) top_frame, bottom_frame = self.createFrames(kw) self.createBitmaps(top_frame, kw) self.app = app # self.update_stats_var = tkinter.BooleanVar() self.update_stats_var.set(app.opt.update_player_stats != 0) self.confirm_var = tkinter.BooleanVar() self.confirm_var.set(app.opt.confirm != 0) self.win_animation_var = tkinter.BooleanVar() self.win_animation_var.set(app.opt.win_animation != 0) # frame = tkinter.Frame(top_frame) frame.pack(expand=True, fill='both', padx=5, pady=10) widget = tkinter.Label( frame, text=_("\nPlease enter your name"), # justify='left', anchor='w', takefocus=0) widget.grid(row=0, column=0, columnspan=2, sticky='ew', padx=0, pady=5) w = kw.get("e_width", 30) # width in characters self.player_var = tkinter.Entry(frame, exportselection=1, width=w) self.player_var.insert(0, app.opt.player) self.player_var.grid(row=1, column=0, sticky='ew', padx=0, pady=5) widget = tkinter.Button(frame, text=_('Choose...'), command=self.selectUserName) widget.grid(row=1, column=1, padx=5, pady=5) widget = tkinter.Checkbutton(frame, variable=self.confirm_var, anchor='w', text=_("Confirm quit")) widget.grid(row=2, column=0, columnspan=2, sticky='ew', padx=0, pady=5) widget = tkinter.Checkbutton(frame, variable=self.update_stats_var, anchor='w', text=_("Update statistics and logs")) widget.grid(row=3, column=0, columnspan=2, sticky='ew', padx=0, pady=5) # widget = tkinter.Checkbutton(frame, variable=self.win_animation_var, # text="Win animation") # widget.pack(side='top', padx=kw.padx, pady=kw.pady) frame.columnconfigure(0, weight=1) # self.player = self.player_var.get() self.confirm = self.confirm_var.get() self.update_stats = self.update_stats_var.get() self.win_animation = self.win_animation_var.get() # focus = self.createButtons(bottom_frame, kw) self.mainloop(focus, kw.timeout)
def show_info(*args): if list_box.curselection(): cs_name = list_box.get(list_box.curselection()) cs = cardsets_dict[cs_name] fn = os.path.join(cs.dir, 'COPYRIGHT') top = tkinter.Toplevel() text = tkinter.Text(top) text.insert('insert', open(fn).read()) text.pack(expand=tkinter.YES, fill=tkinter.BOTH) b_frame = tkinter.Frame(top) b_frame.pack(fill=tkinter.X) button = tkinter.Button(b_frame, text='Close', command=top.destroy) button.pack(side=tkinter.RIGHT)
def __init__(self, master, initial_path='', change_path_cb=None): tk.Frame.__init__(self, master) self.change_path_cb = change_path_cb self.refresh_but = tk.Button(self, text='Refresh') self.refresh_but.grid(row=0, sticky='w') self.path_entry = HistoryCombobox(self, initial_path) self.path_entry.grid(row=0, column=1, sticky='ew') self.path_entry.bind('<Return>', self.path_changed) self.path_entry.bind('<<ComboboxSelected>>', self.path_changed) self.columnconfigure(1, weight=1)
def _showList(self): """ Creates a new window containing a copy-and-paste aware list of the points. """ def _quitWin(): win.destroy() win = tk.Tk() text = tk.Text(master=win) text.pack() for p in self.pointList: text.insert(tk.END, p.asStr() + "\n") quit = tk.Button(master=win, text='Quit', command=_quitWin) quit.pack() win.wm_title("Copy Window")
def show_config(): if list_box.curselection(): cs_name = list_box.get(list_box.curselection()) card_set = cardsets_dict[cs_name] file_name = os.path.join(card_set.cs_dir, 'config.txt') top = tkinter.Toplevel() text = tkinter.Text(top) text.insert('insert', open(file_name).read()) text.pack(expand=tkinter.YES, fill=tkinter.BOTH) b_frame = tkinter.Frame(top) b_frame.pack(fill=tkinter.X) button = tkinter.Button(b_frame, text='Close', command=top.destroy) button.pack(side=tkinter.RIGHT)
def _Button(self, text, image_file, toggle, frame): if image_file is not None: im = Tk.PhotoImage(master=self, file=image_file) else: im = None if not toggle: b = Tk.Button(master=frame, text=text, padx=2, pady=2, image=im, command=lambda: self._button_click(text)) else: b = Tk.Checkbutton(master=frame, text=text, padx=2, pady=2, image=im, indicatoron=False, command=lambda: self._button_click(text)) b._ntimage = im b.pack(side=Tk.LEFT) return b
def __init__(self, parent=None): tk.Frame.__init__(self, parent) self.parent = parent self.init_ui() self.commmnity_lbl = tk.Label(self.parent, text="Comunidad") self.commmnity_lbl.pack() self.commmnity_lbl.place(relx=.1, rely=.1, anchor="c") self.com_text = tk.Entry(self.parent) self.com_text.insert(0, "gr_4cm1") self.com_text.pack() self.com_text.place(relx=.3, rely=0.1, anchor="c") self.ip_lbl = tk.Label(self.parent, text="IP:") self.ip_lbl.pack() self.ip_lbl.place(relx=.1, rely=0.15, anchor="c") self.ip_text = tk.Entry(self.parent) self.ip_text.insert(0, "localhost") self.ip_text.pack() self.ip_text.place(relx=.3, rely=.15, anchor="c") self.thresh_lbl = tk.Label(self.parent, text="Umbral: (bp,go,set)") self.thresh_lbl.pack() self.thresh_lbl.place(relx=.1, rely=0.2, anchor="c") self.thresh_text = tk.Entry(self.parent) self.thresh_text.insert(0, "25, 80, 20") self.thresh_text.pack() self.thresh_text.place(relx=.3, rely=.2, anchor="c") self.options_oid = ttk.Combobox(self.parent) self.options_oid.place(relx=0.3, rely=0.3, anchor="c") self.options_oid["values"] = ["RAM", "CPUload", "DISCO"] self.oids = { "CPUload": "iso.3.6.1.2.1.25.3.3.1.2.196608", "RAM": "1.3.6.1.4.1.2021.4.6.0", "DISCO": "1.3.6.1.2.1.1.3.0" } self.btn_start = tk.Button(self.parent, text="Start", command=self.run) self.btn_start.pack() self.btn_start.place(relx=0.1, rely=.35, anchor="c")
def __init__(self, root, timeout=60): tk.Frame.__init__(self, root) self.root = root self._counter = timeout self.countdown_1 = tk.Label(self, text='Build will start in...', font=('Helvetica', 16)) self.countdown_2 = tk.Label(self, text=self._counter, font=('Helvetica', 16)) self.countdown_3 = tk.Label(self, text='... or ...') self.image_now = tk.Button(self, text='Image Now', command=self._Quit, font=('Helvetica', 18)) self.countdown_1.grid(row=0, column=0) self.countdown_2.grid(row=0, column=1) self.countdown_3.grid(row=0, column=2) self.image_now.grid(row=0, column=3)
def __init__(self, parent, image=None, **kwargs): tk.Frame.__init__(self, parent) self.parent = parent self.input_list = [] if not image: image = os.path.join('static', 'fileicon.png') self.photo = tk.PhotoImage(file=image) self.photo = self.photo.subsample(8) frame_ops = funcs.extract_args(kwargs, FRAME_KEYS, FRAME_KEY) frame = tk.Frame(self, frame_ops) frame.pack(fill='both', expand=True) label_ops = funcs.extract_args(kwargs, LABEL_KEYS, LABEL_KEY) label = tk.Label(frame, label_ops) tvar = tk.StringVar() entry_ops = funcs.extract_args(kwargs, ENTRY_KEYS, ENTRY_KEY) entry_ops['textvariable'] = tvar entry = tk.Entry(frame, entry_ops) self.input_list.append(entry) button_ops = funcs.extract_args(kwargs, BUTTON_KEYS, BUTTON_KEY) button_ops['command'] = self._open button_ops['image'] = self.photo file_button = tk.Button(frame, button_ops) self.input_list.append(file_button) label.pack(side='top', fill='x', expand=True) entry.pack(side='left', fill='x', expand=True) file_button.pack(side='right', expand=False) entry.focus_force() self.parent.columnconfigure(0, weight=1) self.insert = entry.insert self.delete = entry.delete self.get = entry.get self.set = tvar.set self.index = entry.index self.bind = entry.bind self.enable = self._enable self.normal = self._enable self.disable = self._disable self.clear = lambda: funcs.clear(entry)
def __init__(self, parent, title, app, **kw): kw = self.initKw(kw) MfxDialog.__init__(self, parent, title, kw.resizable, kw.default) top_frame, bottom_frame = self.createFrames(kw) self.createBitmaps(top_frame, kw) frame = tkinter.Frame(top_frame) frame.pack(expand=True, fill='both', padx=5, pady=10) frame.columnconfigure(0, weight=1) self.fonts = {} row = 0 for fn, title in ( # ('default', _('Default')), ('sans', _('HTML: ')), ('small', _('Small: ')), ('fixed', _('Fixed: ')), ('canvas_default', _('Tableau default: ')), ('canvas_fixed', _('Tableau fixed: ')), ('canvas_large', _('Tableau large: ')), ('canvas_small', _('Tableau small: ')), ): font = app.opt.fonts[fn] self.fonts[fn] = font tkinter.Label(frame, text=title, anchor='w').grid(row=row, column=0, sticky='we') if font: title = self._font2title(font) elif font is None: title = 'Default' label = tkinter.Label(frame, font=font, text=title) label.grid(row=row, column=1) b = tkinter.Button( frame, text=_('Change...'), width=10, command=lambda label=label, fn=fn: self.selectFont(label, fn)) b.grid(row=row, column=2) row += 1 # focus = self.createButtons(bottom_frame, kw) self.mainloop(focus, kw.timeout)