You're fro loop could be speeded with a generator :
        root.__set_children__( i for i in root.__get_children__() if i is  
not child  )

But I dont really understand the propose qof you try except. (in most  
case, a bare except is avery bad idea (since it begin to catch Syntax  
error and such.)


On 3 juil. 07, at 01:44, Lunpa, The wrote:

> Thats good in some cases for persistent widgets that you have a known
> quantity of at all times.
>
> I've built a work around, since the closest thing I can find is
> __get_children__() and __set_children__()
> Its a bit crude, but it works, so I'll post it:
>
>  def remove_widget(child, root=None):
>         """Because there is no RootWidget.remove_child(foo) method!"""
>         try:
>             if not root:
>                 root = soya.root_widget
>             old_children = root.__get_children__()
>             children = [ ]
>             for i in old_children:
>                 if i != child:
>                     children.append(i)
>
>             root.__set_children__(children)
>             return True
>         except:
>             return False
>
>
> On 7/2/07, Holcroft Jean-Baptiste <[EMAIL PROTECTED]> wrote:
>> maybe you can hide your child
>>
>> 2007/7/2, Lunpa, The <[EMAIL PROTECTED]>:
>>> Once a child has been added to in pudding (such as with
>>> pudding.RootWidget.add_child), is there a good way to _remove_  
>>> it?  I
>>> can't find anything like pudding.RootWidget.remove_child() or  
>>> whatnot.
>>>
>>> _______________________________________________
>>> Soya-user mailing list
>>> Soya-user@gna.org
>>> https://mail.gna.org/listinfo/soya-user
>>>
>>
>>
>> _______________________________________________
>> Soya-user mailing list
>> Soya-user@gna.org
>> https://mail.gna.org/listinfo/soya-user
>>
>>
>
>
> -- 
> This email message is public domain.  Have a nice day! ^_^
>
> _______________________________________________
> Soya-user mailing list
> Soya-user@gna.org
> https://mail.gna.org/listinfo/soya-user
>




-- 
marmoute




_______________________________________________
Soya-user mailing list
Soya-user@gna.org
https://mail.gna.org/listinfo/soya-user

Reply via email to