Support single callback that do not get any number

This commit is contained in:
Florian Festi 2016-07-13 13:35:08 +02:00
parent 4dd61691d2
commit a2a2695c03
1 changed files with 4 additions and 1 deletions

View File

@ -391,7 +391,10 @@ class Boxes:
self.ctx.save()
self.moveTo(x, y)
if callable(callback):
callback(number)
if number is None:
callback()
else:
callback(number)
elif hasattr(callback, '__getitem__'):
try:
callback = callback[number]