(parent)
| 258 | |
| 259 | |
| 260 | def _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 | |
| 294 | if __name__ == '__main__': |
nothing calls this directly
no test coverage detected
searching dependent graphs…