def app(): global root, sz, rz, rex0 root = Tk() root.resizable(height=False, width=True) root.title(windowTitle) root.minsize(width=250, height=0) sz = FindZone("find", initialFind, initialText) sz.fld.bind("<Button-1>", launchRefresh) sz.fld.bind("<ButtonRelease-1>", launchRefresh) sz.fld.bind("<B1-Motion>", launchRefresh) sz.rexSel = re.compile("") rz = ReplaceZone("repl", initialRepl, "") rex0 = re.compile(r"(?<!\\)\\([0-9]+)") root.bind_all("<Key>", launchRefresh) launchRefresh(None) root.mainloop()
def app(): global root, sz, rz, rex0 root = Tk() root.resizable(height=False,width=True) root.title(windowTitle) root.minsize(width=250,height=0) sz = FindZone("find",initialFind,initialText) sz.fld.bind("<Button-1>",launchRefresh) sz.fld.bind("<ButtonRelease-1>",launchRefresh) sz.fld.bind("<B1-Motion>",launchRefresh) sz.rexSel = re.compile("") rz = ReplaceZone("repl",initialRepl,"") rex0 = re.compile(r"(?<!\\)\\([0-9]+)") root.bind_all("<Key>",launchRefresh) launchRefresh(None) root.mainloop()
global button_index global pressed if button_index is None: unpress() update(message="pressed: %s, %s" % (e.keycode, e.keysym)) for i, code_data in kbd._codes.items(): if code_data is None: continue if code_data[0] != e.keycode: continue iid = b2id[i] cnv.itemconfig(iid, fill=color_pressed) pressed.append(iid) return key = (e.keycode, e.keysym) kbd._codes[button_index] = key cnv.itemconfig(b2tid[button_index], text=key_lb_fmt % key) update(message=MSG_SET) root.bind_all("<Key>", on_key, "+") update() root.mainloop()