[Sugar-devel] error in passing image from pygame to js
Sam Parkinson
sam.parkinson3 at gmail.com
Thu Jul 17 07:06:50 EDT 2014
Hi,
What is in the JS logs (please run the activity and send me the activity's
logs)? I had a look through the code being called to send that data back
to the JS side and saw nothing weird.
Also is your activity on a git repository? I would like to have a look :)
Sam
On Wed, Jul 16, 2014 at 9:57 PM, Puneet Kaur <puneet.gkaur at gmail.com> wrote:
> sure , thanks for informing
>
>
> On Wed, Jul 16, 2014 at 5:00 PM, Gonzalo Odiard <godiard at sugarlabs.org>
> wrote:
>
>> I don't know about the js part, but would be better don't use pygame.
>> We have a lot of problems with th interaction between pygame and gtk.
>> Would be better use gstreamer.
>>
>> Gonzalo
>>
>>
>> On Wed, Jul 16, 2014 at 8:07 AM, Puneet Kaur <puneet.gkaur at gmail.com>
>> wrote:
>>
>>> yup, 1) I am getting the data to send
>>>
>>> 2) the loop does stops as required
>>>
>>> 3) self._client refers to the activity api in apisocket.py ( the
>>> function has been defined in apisoscket.py's activity api class)
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Wed, Jul 16, 2014 at 4:15 PM, Sam Parkinson <sam.parkinson3 at gmail.com
>>> > wrote:
>>>
>>>> Hi,
>>>>
>>>> Are you getting data to send? Does the loop stop?
>>>>
>>>> Please give us the context (what is this self._client?).
>>>>
>>>> Thanks,
>>>> Sam
>>>>
>>>>
>>>> P.S. Don't use `while quit_loop:`, use `while True` and `break` to
>>>> quit the loop
>>>>
>>>>
>>>> On Wed, Jul 16, 2014 at 5:08 PM, Puneet Kaur <puneet.gkaur at gmail.com>
>>>> wrote:
>>>>
>>>>> *Hey,*
>>>>>
>>>>> *I am working on camera plugin for sugar cordova.*
>>>>>
>>>>> *I used pygame to click the user's photograph by the following code : *
>>>>>
>>>>>
>>>>> def camera(self,request):
>>>>> os.environ['SDL_VIDEO_CENTERED'] = '1'
>>>>> pygame.init()
>>>>> pygame.camera.init()
>>>>> screen=pygame.display.set_mode((640,480),pygame.NOFRAME )
>>>>> camlist = pygame.camera.list_cameras()
>>>>> if camlist:
>>>>> cam = pygame.camera.Camera(camlist[0],(640,480))
>>>>> cam.start()
>>>>> quit_loop=0
>>>>> base64data=None
>>>>> while quit_loop == 0:
>>>>> cam_image=cam.get_image()
>>>>> screen.blit(cam_image,(0,0))
>>>>> pygame.display.update()
>>>>> for event in pygame.event.get():
>>>>> if event.type == MOUSEBUTTONDOWN:
>>>>> data = pygame.image.tostring(screen,"RGBA")
>>>>> base64data = base64.b64encode(data)
>>>>> #logging.error("base64 :\n %s",base64data)
>>>>> cam.stop()
>>>>> pygame.display.quit()
>>>>> quit_loop=1
>>>>> logging.error("got base64 image")
>>>>> self._client.send_result(request,base64data)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> *The issue is that I am not able to send data back to the javascript
>>>>> side from python side.*
>>>>>
>>>>> *I am attaching shell.log along if anyone wishes to have a look over
>>>>> it.*
>>>>>
>>>>> *would be nice if someone can help me know why am I not able to send
>>>>> the data to javascript side.*
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Regards,
>>>>> Puneet
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Sugar-devel mailing list
>>>>> Sugar-devel at lists.sugarlabs.org
>>>>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>>>>
>>>>>
>>>>
>>>
>>> _______________________________________________
>>> Sugar-devel mailing list
>>> Sugar-devel at lists.sugarlabs.org
>>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>>
>>>
>>
>>
>> --
>> Gonzalo Odiard
>>
>> SugarLabs - Software for children learning
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20140717/d058e9c5/attachment.html>
More information about the Sugar-devel
mailing list