-
Notifications
You must be signed in to change notification settings - Fork 1
layout configurations
DavideMasini edited this page Aug 20, 2021
·
1 revision
Aside from the default single-layout config (which can be seen in the getting started page) the toolkit allows for several other possible configurations of the layouts on the screen.
- The first is the same default layout config which was just mentioned - displays a single layout which occupies the entire space:
main_layout = BoxLayout()
return main_layout
- Layouts in a list - displays vertically stacked layouts all equal in size:
top_layout = BoxLayout()
bottom_layout = BoxLayot()
screen = [top_layout, bottom_layout]
return screen
- Layouts in a dictionary - displays vertically stacked list with the heights of each layout determined by a provided 0 -> 1 size:
top_layout = BoxLayout()
bottom_layout = BoxLayout()
screen = {top_layout : 0.6, bottom_layout : 0.4}
return screen
- Nested lists of Layouts - each nested list of layout/s represents a column in which the heights of the layouts are split equally and where the width of the columns are also split equally:
col1_top_layout = BoxLayout()
col1_bottom_layout = BoxLayout()
col2_layout = BoxLayout()
screen = [[col1_top_layout, col1_bottom_layout], [col2_layout]]
return screen
- Nested dictionaries of Layouts - each nested dictionary of layout/s represents a column in which the heights of the layouts is determined by a provided 0 -> 1 size and where the width of the columns are split equally:
col1_top_layout = BoxLayout()
col1_bottom_layout = BoxLayout()
col2_top_layout = BoxLayout()
col2_bottom_layout = BoxLayout()
screen = [{col1_top_layout : 0.8, col1_bottom_layout : 0.2}, {col2_top_layout : 0.4, col2_bottom_layout : 0.6}]
return screen
- Nested dictionaries and lists of layouts - each nested list (with underlying dictionary of layout/s) represents a column in which the heights of the layouts is determined by a provided 0 -> 1 size and where the width of the columns are also determined by a provided 0 -> 1 size.
col1_top_layout = BoxLayout()
col1_bottom_layout = BoxLayout()
col2_top_layout = BoxLayout()
col2_bottom_layout = BoxLayout()
column1 = [{col1_top_layout : 0.8, col1_bottom_layout : 0.2}, 0.6]
column2 = [{col2_top_layout : 0.4, col2_bottom_layout : 0.6}, 0.4]
screen = [column1, column2]
return screen