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

Function _replace_dialog

tools/python-3.11.9-amd64/Lib/idlelib/replace.py:261–292  ·  view source on GitHub ↗
(parent)

Source from the content-addressed store, hash-verified

259
260
261def _replace_dialog(parent): # htest #
262 from tkinter import Toplevel, Text, END, SEL
263 from tkinter.ttk import Frame, Button
264
265 top = Toplevel(parent)
266 top.title("Test ReplaceDialog")
267 x, y = map(int, parent.geometry().split('+')[1:])
268 top.geometry("+%d+%d" % (x, y + 175))
269
270 # mock undo delegator methods
271 def undo_block_start():
272 pass
273
274 def undo_block_stop():
275 pass
276
277 frame = Frame(top)
278 frame.pack()
279 text = Text(frame, inactiveselectbackground='gray')
280 text.undo_block_start = undo_block_start
281 text.undo_block_stop = undo_block_stop
282 text.pack()
283 text.insert("insert","This is a sample sTring\nPlus MORE.")
284 text.focus_set()
285
286 def show_replace():
287 text.tag_add(SEL, "1.0", END)
288 replace(text)
289 text.tag_remove(SEL, "1.0", END)
290
291 button = Button(frame, text="Replace", command=show_replace)
292 button.pack()
293
294
295if __name__ == '__main__':

Callers

nothing calls this directly

Calls 10

insertMethod · 0.95
ToplevelClass · 0.90
FrameClass · 0.90
TextClass · 0.90
ButtonClass · 0.90
mapFunction · 0.50
titleMethod · 0.45
splitMethod · 0.45
packMethod · 0.45
focus_setMethod · 0.45

Tested by

no test coverage detected