On 04/06/16 23:44, VA wrote:
Le 04/06/2016 20:37, Baz Walter a écrit :
Just use normal python types:

    >>> text = b'hello world'
    >>> self.SendScintilla(self.SCI_ANNOTATIONSETTEXT, 1, text)
    >>> size = self.SendScintilla(QSB.SCI_ANNOTATIONGETTEXT, 1, 0)
    >>> print len(text), repr(size)
    11 11L
    >>> buf = bytearray(size)
    >>> self.SendScintilla(self.SCI_ANNOTATIONGETTEXT, 1, buf)
    print len(buf), repr(buf)
    11 bytearray(b'hello world')

And note that you don't need to allow for the terminating null (in python).

This is amazing, it works! I discovered the bytearray type.
Thank you very much!

How come the bytearray is accepted, while there's no trace of it in case
of TypeError?


It would seem "str" allows for both bytes and bytearray objects. So the relevant overload is:

    SendScintilla(self, int, int, str)

--
Regards
Baz Walter
_______________________________________________
QScintilla mailing list
[email protected]
https://www.riverbankcomputing.com/mailman/listinfo/qscintilla

Reply via email to