예제 #1
0
    def toggle1():
        if var1.get() == 0:
            var1.set(1)
            p.insertfilter(t1)
        elif var1.get() == 1:
            var1.set(0)
            p.removefilter(t1)

    def toggle2():
        if var2.get() == 0:
            var2.set(1)
            p.insertfilter(t2)
        elif var2.get() == 1:
            var2.set(0)
            p.removefilter(t2)

    text.pack()
    var1 = tk.IntVar()
    cb1 = tk.Checkbutton(root, text="Tracer1", command=toggle1, variable=var1)
    cb1.pack()
    var2 = tk.IntVar()
    cb2 = tk.Checkbutton(root, text="Tracer2", command=toggle2, variable=var2)
    cb2.pack()

    root.mainloop()

if __name__ == "__main__":
    from MrPython.idle_test.htest import run
    run(_percolator)
예제 #2
0
    def find_selection(self, text):
        pat = text.get("sel.first", "sel.last")
        if pat:
            self.engine.setcookedpat(pat)
        return self.find_again(text)


def _search_dialog(parent):
    root = Tk()
    root.title("Test SearchDialog")
    width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
    root.geometry("+%d+%d" % (x, y + 150))
    text = Text(root)
    text.pack()
    text.insert("insert", "This is a sample string.\n" * 10)

    def show_find():
        text.tag_add(SEL, "1.0", END)
        s = _setup(text)
        s.open(text)
        text.tag_remove(SEL, "1.0", END)

    button = Button(root, text="Search", command=show_find)
    button.pack()


if __name__ == '__main__':
    from MrPython.idle_test.htest import run
    run(_search_dialog)
예제 #3
0
            text.bell()
            return False

    def find_selection(self, text):
        pat = text.get("sel.first", "sel.last")
        if pat:
            self.engine.setcookedpat(pat)
        return self.find_again(text)

def _search_dialog(parent):
    root = Tk()
    root.title("Test SearchDialog")
    width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
    root.geometry("+%d+%d"%(x, y + 150))
    text = Text(root)
    text.pack()
    text.insert("insert","This is a sample string.\n"*10)

    def show_find():
        text.tag_add(SEL, "1.0", END)
        s = _setup(text)
        s.open(text)
        text.tag_remove(SEL, "1.0", END)

    button = Button(root, text="Search", command=show_find)
    button.pack()

if __name__ == '__main__':
    from MrPython.idle_test.htest import run
    run(_search_dialog)