def btn_solve_on_click(self):
if self.grp is None or self.img is None:
tkMessageBox.showerror("Error", "Please load a maze first!")
return
self.perform_process(lambda: self.traverse_graph(), "Traversing graph...")
self.perform_process(lambda: self.write_to_file(), "Writing to file...")
tkMessageBox.showinfo("Info",
"Solved the maze in " + str(self.steps) + " steps!\n" +
"Path length:\t\t%d\n" % self.graph_traverser.path_length +
"Graph loading time:\t\t%.5lfs\n" % self.exec_time +
"Graph traverse time:\t\t%.5lfs\n" % (self.traverse_time_end - self.traverse_time_start) +
"File writing time:\t\t%.5lfs\n" % (self.imgwrite_time_end - self.imgwrite_time_start) +
"Total execution time:\t\t%.5lfs" % (self.exec_time + (self.imgwrite_time_end - self.traverse_time_start))
)
if self.show_solution.get() == True:
# Showing solution in new window
if sys.platform.startswith('linux'):
subprocess.call(["xdg-open", self.output_path])
else:
os.startfile(self.output_path)
评论列表
文章目录