def __init__(self, histfile=None, globs=None): self.histfile = histfile if histfile and os.path.isfile(histfile): self.history = observed_list(open(histfile).read().splitlines()) else: self.history = observed_list() self.histindex = len(self.history) self.globs = globs if globs is not None else {} self.history.append("")
command=addchild), UI(Button, text='-', command=delwidget) ]) ]), UI(tkui.BoxedTree, name="tree"), ]) ]) uiroot.makeelem() setfonts() terp.bind_keys(uidict["tkterp"]) uidict['hint terp'].bind('<Return>', tkguide.next_hint) uidict['hint terp'].bind('<KP_Enter>', tkguide.next_hint) tkuilist = observed_list(["Entry"]) treeelem = uidict["tree"] treeelem._tree.append(uiroot) treeelem._tree.elem = None treeelem.redraw() style = ttk.Style(uidict["root"]) style.configure('Treeview', rowheight=14 * 2) treeelem.column("#0", minwidth=0, width=800) uitree = tkui.UITree(uiroot, treeelem) uidict["tree"].bind('<<TreeviewSelect>>', select_callback) #uidict["params"]._dict.callbacks.append(update_param) tkuitree = treeelem.ui uilist = uidict["uilistframe"].ui undolog = tkui.UndoLog()
def __init__(self, *args, **kwargs): logging.debug("Creating BoxedList with %s %s", args, kwargs) self._list = kwargs.pop("_list", observed_list()) self._list.callbacks.append(self.callback) tk.Listbox.__init__(self, *args, **kwargs) self.redraw()
marker.winfo_manager())) def setfonts(): for fontname in tkFont.names(): default_font = tkFont.nametofont(fontname) default_font.configure(size=14) # Get all widgets from Tkinter tkuilist = [ "tk.%s" % e for e in dir(tk) if e.capitalize() == e and len(e) > 2 and not e.startswith("_") ] tkuilist += ["Entry", "BoxedBool", "BoxedList", "BoxedDict", "BoxedTree"] tkuilist = observed_list(tkuilist) if __name__ == "__main__": #logging.basicConfig(level=logging.DEBUG) from Tkinter import Tk, Label, Frame, Button, Canvas histfile = "tkui_history" terp = TkTerp(histfile) def quit(): logging.info("Shutting down...") terp.save() uidict["root"].destroy() execfile(os.path.join(os.path.dirname(__file__), "functions.py")) execfile(os.path.join(os.path.dirname(__file__), "generated_tree.py"))