Return the contents of the widget between index1 and index2. The type of contents returned in filtered based on the keyword parameters; if 'all', 'image', 'mark', 'tag', 'text', or 'window' are given and true, then the corresponding items are returned. The result
(self, index1, index2=None, command=None, **kw)
| 3695 | return self._getints(self.tk.call(self._w, 'dlineinfo', index)) |
| 3696 | |
| 3697 | def dump(self, index1, index2=None, command=None, **kw): |
| 3698 | """Return the contents of the widget between index1 and index2. |
| 3699 | |
| 3700 | The type of contents returned in filtered based on the keyword |
| 3701 | parameters; if 'all', 'image', 'mark', 'tag', 'text', or 'window' are |
| 3702 | given and true, then the corresponding items are returned. The result |
| 3703 | is a list of triples of the form (key, value, index). If none of the |
| 3704 | keywords are true then 'all' is used by default. |
| 3705 | |
| 3706 | If the 'command' argument is given, it is called once for each element |
| 3707 | of the list of triples, with the values of each triple serving as the |
| 3708 | arguments to the function. In this case the list is not returned.""" |
| 3709 | args = [] |
| 3710 | func_name = None |
| 3711 | result = None |
| 3712 | if not command: |
| 3713 | # Never call the dump command without the -command flag, since the |
| 3714 | # output could involve Tcl quoting and would be a pain to parse |
| 3715 | # right. Instead just set the command to build a list of triples |
| 3716 | # as if we had done the parsing. |
| 3717 | result = [] |
| 3718 | def append_triple(key, value, index, result=result): |
| 3719 | result.append((key, value, index)) |
| 3720 | command = append_triple |
| 3721 | try: |
| 3722 | if not isinstance(command, str): |
| 3723 | func_name = command = self._register(command) |
| 3724 | args += ["-command", command] |
| 3725 | for key in kw: |
| 3726 | if kw[key]: args.append("-" + key) |
| 3727 | args.append(index1) |
| 3728 | if index2: |
| 3729 | args.append(index2) |
| 3730 | self.tk.call(self._w, "dump", *args) |
| 3731 | return result |
| 3732 | finally: |
| 3733 | if func_name: |
| 3734 | self.deletecommand(func_name) |
| 3735 | |
| 3736 | ## new in tk8.4 |
| 3737 | def edit(self, *args): |