partsMatrix: support width=0 for all parts in one row

This commit is contained in:
Florian Festi 2019-12-10 19:14:07 +01:00
parent e2b87af2a4
commit 4d53bd17cc
1 changed files with 4 additions and 1 deletions

View File

@ -2116,7 +2116,7 @@ class Boxes:
"""place many of the same part """place many of the same part
:param n: number of parts :param n: number of parts
:param width: number of parts in a row :param width: number of parts in a row (0 for same as n)
:param move: (Default value = None) :param move: (Default value = None)
:param part: callable that draws a part and knows move param :param part: callable that draws a part and knows move param
:param \*l: params for part :param \*l: params for part
@ -2125,6 +2125,9 @@ class Boxes:
if n <= 0: if n <= 0:
return return
if not width:
width = n
rows = n//width + (1 if n % width else 0) rows = n//width + (1 if n % width else 0)
if not move: if not move: