Am 27.11.2005 um 19:23 schrieb vincent rioux:
By the way i am running into problems with the ._send() method of pyext. For example i would like to setup gemwin, to different configurations :
[pyx gemwin config] | [r gemwin] | [gemwin]
On windows, when i send:
._send('gemwin', 'create') i get no method for symbol
._send('gemwin', 'border', 0) i get the same message but it works on macosx...
._send('gemwin', 1) it works
sorry, i know sven already helped with that but i really get confused with this syntax and the terms symbol, list, float from Pd list, tuple, string, numbers of Python
yes, this is not too easy, but i think it will be clear once it is understood. Let's look at the _outlet method first:
list message [list arg1 arg2 arg3 ....( 2) self._outlet(outletnr,tag,(arg1,arg2,arg3,....) will generate a tag message [tag arg1 arg2 arg3 ....(
the variation of 2)
self._outlet(outletnr,'list',(arg1,arg2,arg3,....)) is the same as 1)
When there's only one arg, like in self._outlet(outletnr,arg), this arg will be converted to a symbol or a float message dependent on it's type E.g. self._outlet(outlet,1) will give [float 1( which is the same as just [1( while self._outlet(outletnr,'hey') will give [symbol hey( which is _not_ the same as [hey( !
some examples:
._outlet(1,1,2,3) will send a message [list 1 2 3( ._outlet(1,1) will send a message [float 1( ._outlet(1,'a','b','c') will send a message [list a b c( ._outlet(1,'a') will send a message [symbol a( ._outlet(1,'message',(1,2) ) will send a message [message 1 2(
._outlet(1,'message',1) will send a message [list message 1( ._outlet(1,'message',(1,)) will send a message [message 1(
(element, )
the same applies for the _send method, except there's the receiver symbol replacing outletnr. Therefore,
._send('gemwin','create') will generate a [symbol create( message sent to [r gemwin] , which is not understood Instead you will want to use ._send('gemwin','create',()) instead which makes a [create( message
._send('gemwin','border',0) will generate [list border 0( You'd rather use ._send('gemwin','border',(0,)) The original version works on your OSX installation because you're obviously using an old pyext version there, which doesn't recognize the refined syntax
and lastly, ._send('gemwin',1) will generate [float 1( which is just ok.
Something else i am searching for is how do i exchange numarrays between pd and python.
You have two possibilites:
._send the array gets converted into a list of elements
to a PD buffer: see buffer-*.pd examples
best greetings, Thomas