It allows to add child widgets to this. The key allows to access the specific child in this way container.children[key]. The key have to be numeric and determines the children order in the layout. Args: value (Widget): Child instance to be appended. k
(self, value, key='')
| 1926 | self.style['align-items'] = self.style.get('align-items', 'center') |
| 1927 | |
| 1928 | def append(self, value, key=''): |
| 1929 | """It allows to add child widgets to this. |
| 1930 | The key allows to access the specific child in this way container.children[key]. |
| 1931 | The key have to be numeric and determines the children order in the layout. |
| 1932 | |
| 1933 | Args: |
| 1934 | value (Widget): Child instance to be appended. |
| 1935 | key (str): Unique identifier for the child. If key.isdigit()==True '0' '1'.. the value determines the order |
| 1936 | in the layout |
| 1937 | """ |
| 1938 | if type(value) in (list, tuple, dict): |
| 1939 | if type(value)==dict: |
| 1940 | for k in value.keys(): |
| 1941 | self.append(value[k], k) |
| 1942 | return value.keys() |
| 1943 | keys = [] |
| 1944 | for child in value: |
| 1945 | keys.append( self.append(child) ) |
| 1946 | return keys |
| 1947 | |
| 1948 | key = str(key) |
| 1949 | if not isinstance(value, Widget): |
| 1950 | raise ValueError('value should be a Widget (otherwise use add_child(key,other)') |
| 1951 | |
| 1952 | del value.css_left |
| 1953 | del value.css_right |
| 1954 | |
| 1955 | if value.css_order == None: |
| 1956 | value.css_position = 'static' |
| 1957 | value.css_order = '-1' |
| 1958 | |
| 1959 | if key.isdigit(): |
| 1960 | value.css_order = key |
| 1961 | |
| 1962 | key = value.identifier if key == '' else key |
| 1963 | self.add_child(key, value) |
| 1964 | |
| 1965 | return key |
| 1966 | |
| 1967 | |
| 1968 | class VBox(HBox): |