On Mon, Jan 19, 2009 at 7:41 PM, Nitro <[email protected]> wrote: > Am 19.01.2009, 21:57 Uhr, schrieb Marcos Duarte <[email protected]>: > >> I want to hide/show an object in FloatCanvas2. >> Is there a hide/show method in FC2 equivalent to the Visible method in >> FC? >> I am able to hide/show an object during its creation with the keyword >> show, however the created object doesn't have an attribute show to >> modify it. > > For whatever reason I called the attribute "shown". E.g. "node.shown = > False" or "node.shown = True". > >> Another question: >> Is there a built-in method in FC2 to find an object by its name? >> (I created a method that searches all children by its name but I am >> wondering if this is already there in FC2) > > Yes, there is. Look into floatcanvas/nodes/nodeVisitor.py . There is a > FindNodesByNamesVisitor. Use it like > > fnbnv = FindNodesByNamesVisitor( [ 'nameToFind1', 'otherNameToFind' ] ) > fnbnv.visit( [rootNode1, rootNode2] ) > foundNodes = fnbnv.nodes > > For the simple case (find a node with a specific name in the canvas) you > can use it like: > > fnbnv = FindNodesByNamesVisitor( [ 'nameToFind' ] ) > fnbnv.visit( canvas ) > foundNodes = fnbnv.nodes > > -Matthias
Both answers work well, thanks. another question: is there a method to determine the type of the object? e.g., such function should return 'circle' or 'arrow' if i input the node object. Marcos _______________________________________________ FloatCanvas mailing list [email protected] http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas
