MCPcopy Index your code
hub / github.com/python/cpython / _replace_dialog

Function _replace_dialog

Lib/idlelib/replace.py:260–291  ·  view source on GitHub ↗
(parent)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…