def clicked_print(): if not check_and_save_categories(): return direc = filedialog.askdirectory(initialdir=path.dirname(__file__)) if not direc: return c = canvas.Canvas(direc + "/" + final_name.cget("text")) pdf_funs.draw_on_canvas(final_puzzle, c) c.showPage() c.save() final_lbl.configure(text="The puzzle has been printed to:\n" + direc + "/" + final_name.cget("text")) final_lbl.grid(row=12, column=0)
def clicked_print(): input_categories = [] n = 0 for j, cat in enumerate(final_puzzle.categories): if cat[0] == 'categorical' or cat[0] == 'ordinal': names = [] for i in range(final_puzzle.k): names.append(cat_cats[n][i + 1].get()) input_categories.append((cat[0], names)) n += 1 if any([name == "" for name in names]): messagebox.showwarning('Warning', 'One or more object names are empty!') return n = 0 for j, cat in enumerate(final_puzzle.categories): if cat[0] == 'numerical': input_categories.append( (cat[0], cat[1], cat[2], num_cats[n][1].get())) n += 1 print(input_categories) if funs.do_categories_repeat(input_categories): messagebox.showwarning('Warning', 'Repeating names detected!') return final_puzzle.categories = input_categories direc = filedialog.askdirectory(initialdir=path.dirname(__file__)) if not direc: return c = canvas.Canvas(direc + "/" + final_name.cget("text")) draw_on_canvas(final_puzzle, c) c.showPage() c.save() final_lbl.configure(text="The puzzle has been printed to:\n" + direc + "/" + final_name.cget("text"))