gui.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:maze-pathfinder 作者: ivan-ristovic 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号