-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement jupyter display for solutions.
- Loading branch information
Showing
2 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import io | ||
|
||
from pretty_poly.image import make_colored_blocks | ||
from pretty_poly.png import _make_png_writer | ||
|
||
def solution_to_png(solution): | ||
data, palette = make_colored_blocks(solution.tiling) | ||
writer = _make_png_writer(data, palette) | ||
f = io.BytesIO() | ||
writer.write(f, data) | ||
return f.getvalue() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters