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 is
(self, index1, index2=None, command=None, **kw)
| 3916 | return self._getints(self.tk.call(self._w, 'dlineinfo', index)) |
| 3917 | |
| 3918 | def dump(self, index1, index2=None, command=None, **kw): |
| 3919 | """Return the contents of the widget between index1 and index2. |
| 3920 | |
| 3921 | The type of contents returned in filtered based on the keyword |
| 3922 | parameters; if 'all', 'image', 'mark', 'tag', 'text', or 'window' are |
| 3923 | given and true, then the corresponding items are returned. The result |
| 3924 | is a list of triples of the form (key, value, index). If none of the |
| 3925 | keywords are true then 'all' is used by default. |
| 3926 | |
| 3927 | If the 'command' argument is given, it is called once for each element |
| 3928 | of the list of triples, with the values of each triple serving as the |
| 3929 | arguments to the function. In this case the list is not returned.""" |
| 3930 | args = [] |
| 3931 | func_name = None |
| 3932 | result = None |
| 3933 | if not command: |
| 3934 | # Never call the dump command without the -command flag, since the |
| 3935 | # output could involve Tcl quoting and would be a pain to parse |
| 3936 | # right. Instead just set the command to build a list of triples |
| 3937 | # as if we had done the parsing. |
| 3938 | result = [] |
| 3939 | def append_triple(key, value, index, result=result): |
| 3940 | result.append((key, value, index)) |
| 3941 | command = append_triple |
| 3942 | try: |
| 3943 | if not isinstance(command, str): |
| 3944 | func_name = command = self._register(command) |
| 3945 | args += ["-command", command] |
| 3946 | for key in kw: |
| 3947 | if kw[key]: args.append("-" + key) |
| 3948 | args.append(index1) |
| 3949 | if index2: |
| 3950 | args.append(index2) |
| 3951 | self.tk.call(self._w, "dump", *args) |
| 3952 | return result |
| 3953 | finally: |
| 3954 | if func_name: |
| 3955 | self.deletecommand(func_name) |
| 3956 | |
| 3957 | ## new in tk8.4 |
| 3958 | def edit(self, *args): |