+ # Export to image/HTML
+ def on_export_image (self, solution=True):
+ try:
+ sys.stdout.write (self.BLUE + "Exporting puzzle to image/HTML\n")
+ pngfile = raw_input (self.BRICKRED + "Filename (PNG): " + self.ENDCOL)
+ if solution is False:
+ htmlfile = raw_input (self.BRICKRED + "Filename (HTML): " +
+ self.ENDCOL)
+ puztitle = raw_input (self.BRICKRED + "Title of puzzle: " +
+ self.ENDCOL)
+ self.puzzle.export_image (pngfile, htmlfile, puztitle, solution)
+ else:
+ self.puzzle.export_image (pngfile)
+
+ sys.stdout.write (self.BLUE + "Successfully exported!")
+ except crosswordpuzzle.FrozenGridException:
+ sys.stderr.write ("Cannot export as grid is not frozen/finalized\n")
+ except crosswordpuzzle.NoWordsException:
+ sys.stderr.write ("No words to export!\n")
+