Re: Issue with 'unsigned char const *'

Robin Dunn <[email protected]>
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
By default sip is expecting an int or int-compatible object for unsigned 
char values, and it doesn't know whether it should be a pointer to a single 
value or an array of values, so it just takes the safest choice. I can 
tweak some things in the wrappers to allow it to accept buffer-compatible 
objects, but in the meantime, is there any reason that MarkerDefineBitmap 
won't work for you?

-- 
Robin Dunn
Software Craftsman
http://wxPython.org



On Tuesday, January 30, 2018 at 6:41:29 AM UTC-8, [email protected] 
wrote:
>
> Hello,
>
> I'm trying to use StyledTextCtrl_MarkerDefineRGBAImage function,
> but I can't find out how the image must be passed.
>
> From scintilla documention I get that it is supposed to be 
>
> SCI_MARKERDEFINERGBAIMAGE(int markerNumber, const char *pixels)
>
> so I thought it should work by providing a string
>
> img = '\x00\x00\x00\x00'
> editor.RGBAImageSetWidth(14)
> editor.MarkerDefineRGBAImage(0,img)
>
>
>
> then I tried passing a list
>
> img = [0,0,0,0]
> editor.MarkerDefineRGBAImage(0,img)
>
>
>
> and finally I tried using ctypes with byte and ubyte
>
> import ctypes
> img = ctypes.c_ubyte*4
> img.from_buffer_copy('\x00\x00\x00\x00')
> <c_ubyte_Array_4 object at 0x7f9902a5c9e0>
> for i in img():
>     print i
>
> 0
> 0
> 0
> 0
>
> editor.MarkerDefineRGBAImage(0,img())
>
> editor.MarkerDefineRGBAImage(0,ctypes.byref(img()))
>
> editor.MarkerDefineRGBAImage(0,ctypes.pointer(img()))
>
> but all returned the same error
>
> Traceback (most recent call last):
>   File "<input>", line 1, in <module>
>   File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/stc.py", line 
> 6371, in MarkerDefineRGBAImage
>     return _stc.StyledTextCtrl_MarkerDefineRGBAImage(*args, **kwargs)
> *TypeError: in method 'StyledTextCtrl_MarkerDefineRGBAImage', expected 
> argument 3 of type 'unsigned char const *'*
>     
> So, how do I provide a 'unsigned char const *'?
>
> Thank you
> Claudia
>

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.