utils.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:x112v4l2 作者: romlok 项目源码 文件源码
def find_child_by_id(root, name):
    """
        Searches through a hierarchy of Gtk widgets for the `name`d

        Returns None if no such child was found.
    """
    # We do a breadth-first search
    next_level = [root]
    while next_level:
        children = next_level
        next_level = []
        for child in children:
            if child is None:
                continue
            if Gtk.Buildable.get_name(child) == name:
                # Bingo
                return child
            if hasattr(child, 'get_children'):
                next_level.extend(child.get_children())
    # Hierarchy exhausted. Ho hum.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号