From: Barry S. <ba...@ba...> - 2008-11-21 19:36:17
|
On 18 Nov 2008, at 23:10, William Newbery wrote: > I couldnt see any area on the sourcefordge stie for posting support > requests, since the new group seems to be read only... Join the PyCXX user list. What is the "new group" you refer to? > > > Anyway the basic question is how do I create member varibles for > classes that can be accessed from python. The basic answer is you implement getattr and setattr. > > > eg I have a Window class, that on creation creates a Input class: > class Window... > { > Input *input; > ... > }; > > I want the user to be able to access this as a varible to the window > instance, ie "mywindow.input.GetMousePos()". > > On the module class you provided a moduleDictionary() to retur a > dict, that i can assign varibles to, however classes dont seem to > have this, I tried implementing it through the getattr method, but > this seems to not work. Try building the examples from the Demo folder. range.cxx implements getattr and works. If you want to look at a substantial example look at the source of http://pysvn.tigris.org that uses lots of PyCXX features. > > > Theres nothing in the docs I can see for doing this, is it something > yet to be implemented or am i going about it the wrong way? You picked the right method getattr. We just need to help you get it working. Barry |