Message202093
I am curious too, so I traced through the call chain.
In PyShell.py
1343: PseudoOutputFile.write(s) calls: self.shell.write(s, self.tags)
914: shell is an instance of PyShell and self.tags is 'stdout', 'stderr', or 'console'.
1291: PyShell.write(s,tags) calls:
OutputWindow.write(self, s, tags, "iomark")
(where 'iomark' must have been defined elsewhere, and the 'gravity' calls should not matter)
In OutputWindow.py
46: OutputWindow(EditorWindow).write(s,tags,mark='insert') calls: self.text.insert(mark, s, tags)
after trying to encode s if isinstance(s, str). It follows with:
self.text.see(mark)
self.text.update()
but if the insert succeeds, these should not care about the source of the inserted chars.
In EditorWindow.py
187: self.text = MultiCallCreator(Text)(text_frame, **text_options)
In MultiCall.py,
304: MultiCallCreator wraps a tk widget in a MultiCall instance that adds event methods but otherwise passes calls to the tk widget.
So PseudoOutputFile(s) becomes tk.Text().insert('iomark', s, 'stdout').
which becomes (lib-tk/tkinter.py, 3050)
self.tk.call((self._w, 'insert', 'iomark', s) + args)
Tk handles either Latin-1 bytes or BMP unicode. It seems fine with a unicode subclass:
>>> import Tkinter as tk
>>> t = tk.Text()
>>> class F(unicode): pass
>>> f = F('foo')
>>> t.insert('1.0', u'abc', 'stdout') # 'iomark' is not defined
>>> t.insert('1.0', f, 'stdout')
>>> t.get('1.0', 'end')
u'abcfoo\n'
I remain puzzled. |
|
Date |
User |
Action |
Args |
2013-11-04 06:55:59 | terry.reedy | set | recipients:
+ terry.reedy, tim.peters, kbk, ned.deily, roger.serwy, serhiy.storchaka |
2013-11-04 06:55:59 | terry.reedy | set | messageid: <1383548159.84.0.0302739780272.issue19481@psf.upfronthosting.co.za> |
2013-11-04 06:55:59 | terry.reedy | link | issue19481 messages |
2013-11-04 06:55:58 | terry.reedy | create | |
|