File tree 1 file changed +22
-8
lines changed
adafruit_displayio_layout/layouts
1 file changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -78,14 +78,28 @@ def _layout_cells(self):
78
78
- 2 * self .cell_padding
79
79
)
80
80
)
81
- cell ["content" ].width = (
82
- int (button_size_x * self ._width / grid_size_x )
83
- - 2 * self .cell_padding
84
- )
85
- cell ["content" ].height = (
86
- int (button_size_y * self ._height / grid_size_y )
87
- - 2 * self .cell_padding
88
- )
81
+ if hasattr (cell ["content" ], "resize" ):
82
+ # if it has resize function
83
+ cell ["content" ].resize (
84
+ (
85
+ int (button_size_x * self ._width / grid_size_x )
86
+ - 2 * self .cell_padding
87
+ ),
88
+ (
89
+ int (button_size_y * self ._height / grid_size_y )
90
+ - 2 * self .cell_padding
91
+ ),
92
+ )
93
+ else :
94
+ # try width and height properties.
95
+ cell ["content" ].width = (
96
+ int (button_size_x * self ._width / grid_size_x )
97
+ - 2 * self .cell_padding
98
+ )
99
+ cell ["content" ].height = (
100
+ int (button_size_y * self ._height / grid_size_y )
101
+ - 2 * self .cell_padding
102
+ )
89
103
90
104
cell ["content" ].x = (
91
105
int (grid_position_x * self ._width / grid_size_x ) + self .cell_padding
You can’t perform that action at this time.
0 commit comments