def ask(): user = r.get(SERVER_ADDRESS) path = save(user.content) page = HtmlPage() page.form_page(path, SERVER_ADDRESS) index = page.save() webbrowser.open(index)
def viewer(ipuz_file_name, rendered_file_name): print('Converting "{}" to "{}"'.format(ipuz_file_name, rendered_file_name)) with open(ipuz_file_name) as puzzle_file: ipuz_dict = ipuz.read( puzzle_file.read()) # may raise ipuz.IPUZException puzzle = crossword.from_ipuz(ipuz_dict) with HtmlPage(rendered_file_name) as draw: draw.heading(1, 'Crossword example') draw.heading( 2, '{} by {}'.format(puzzle.meta['title'], puzzle.meta['publisher'])) # draw the empty crossword board with draw.crossword(puzzle.block) as grid: for row in puzzle: grid.add_row([(get_literal(cell.puzzle), ' ') for cell in row]) # container to hold clues with draw.column_container() as _: # disply ACROSS clues with draw.column() as _: draw.heading(3, 'ACROSS') for number, clue in puzzle.clues.across(): draw.line('{} {}'.format(number, clue)) # disply DOWN clues with draw.column() as _: draw.heading(3, 'DOWN') for number, clue in puzzle.clues.down(): draw.line('{} {}'.format(number, clue)) # draw solution draw.heading(2, 'Solution') with draw.crossword(puzzle.block) as grid: for row in puzzle: grid.add_row([(get_literal(cell.puzzle), cell.solution) for cell in row]) draw.rights(puzzle.meta['rights']) print('Done!')
def process(self): HtmlPage.process(self) if 'bgcolor' in self.form: self.bgcolor = self.form['bgcolor'].value
def __init__(self): HtmlPage.__init__(self, "Do Something") self.bgcolor = 'lightblue'
def __init__(self): HtmlPage.__init__(self, "Painters") self.style = 'body {background-color: lightblue}' \ 'table {background-color: white}'
def __init__(self): HtmlPage.__init__(self, "Hello World")
def __init__(self): HtmlPage.__init__(self, "Now's the time")