MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / ReDemo

Class ReDemo

tools/python-3.11.9-amd64/Tools/demo/redemo.py:8–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6import re
7
8class ReDemo:
9
10 def __init__(self, master):
11 self.master = master
12
13 self.promptdisplay = Label(self.master, anchor=W,
14 text="Enter a Perl-style regular expression:")
15 self.promptdisplay.pack(side=TOP, fill=X)
16
17 self.regexdisplay = Entry(self.master)
18 self.regexdisplay.pack(fill=X)
19 self.regexdisplay.focus_set()
20
21 self.addoptions()
22
23 self.statusdisplay = Label(self.master, text="", anchor=W)
24 self.statusdisplay.pack(side=TOP, fill=X)
25
26 self.labeldisplay = Label(self.master, anchor=W,
27 text="Enter a string to search:")
28 self.labeldisplay.pack(fill=X)
29 self.labeldisplay.pack(fill=X)
30
31 self.showframe = Frame(master)
32 self.showframe.pack(fill=X, anchor=W)
33
34 self.showvar = StringVar(master)
35 self.showvar.set("first")
36
37 self.showfirstradio = Radiobutton(self.showframe,
38 text="Highlight first match",
39 variable=self.showvar,
40 value="first",
41 command=self.recompile)
42 self.showfirstradio.pack(side=LEFT)
43
44 self.showallradio = Radiobutton(self.showframe,
45 text="Highlight all matches",
46 variable=self.showvar,
47 value="all",
48 command=self.recompile)
49 self.showallradio.pack(side=LEFT)
50
51 self.stringdisplay = Text(self.master, width=60, height=4)
52 self.stringdisplay.pack(fill=BOTH, expand=1)
53 self.stringdisplay.tag_configure("hit", background="yellow")
54
55 self.grouplabel = Label(self.master, text="Groups:", anchor=W)
56 self.grouplabel.pack(fill=X)
57
58 self.grouplist = Listbox(self.master)
59 self.grouplist.pack(expand=1, fill=BOTH)
60
61 self.regexdisplay.bind('<Key>', self.recompile)
62 self.stringdisplay.bind('<Key>', self.reevaluate)
63
64 self.compiled = None
65 self.recompile()

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected