[QScintilla] Python SendScintilla with a pointer

VA dev+pyqt at indigo.re
Sat Jun 4 23:44:14 BST 2016


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?

>>> PyQt5.Qsci.QsciScintilla.SendScintilla()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: arguments did not match any overloaded call:
  SendScintilla(self, int, wParam: int = 0, lParam: int = 0): first
argument of unbound method must have type 'QsciScintillaBase'
  SendScintilla(self, int, int, sip.voidptr): first argument of unbound
method must have type 'QsciScintillaBase'
  SendScintilla(self, int, int, str): first argument of unbound method
must have type 'QsciScintillaBase'
  SendScintilla(self, int, str): first argument of unbound method must
have type 'QsciScintillaBase'
  SendScintilla(self, int, str, str): first argument of unbound method
must have type 'QsciScintillaBase'
  SendScintilla(self, int, int): first argument of unbound method must
have type 'QsciScintillaBase'
  SendScintilla(self, int, int, int, str): first argument of unbound
method must have type 'QsciScintillaBase'
  SendScintilla(self, int, int, Union[QColor, Qt.GlobalColor]): first
argument of unbound method must have type 'QsciScintillaBase'
  SendScintilla(self, int, Union[QColor, Qt.GlobalColor]): first
argument of unbound method must have type 'QsciScintillaBase'
  SendScintilla(self, int, int, QPainter, QRect, int, int): first
argument of unbound method must have type 'QsciScintillaBase'
  SendScintilla(self, int, int, QPixmap): first argument of unbound
method must have type 'QsciScintillaBase'
  SendScintilla(self, int, int, QImage): first argument of unbound
method must have type 'QsciScintillaBase'



More information about the QScintilla mailing list