Esempio n. 1
0
    def lsBtnCallback(self):
        global length
        global matrix
        global isLS_CLICK
        global ls_res

        v0 = int(self.input_1.get())
        v1 = int(self.input_2.get())

        if hasattr(self, 'comboBox'):
            self.comboBox.destroy()
            self.comboBox_label.destroy()
        if hasattr(self, 'treeview'):
            self.treeview.destroy()
        if hasattr(self, 'error'):
            self.error.destroy()

        if not isLS_CLICK:
            isLS_CLICK = True

        ls_res = ls.dijkstra(length, copy.deepcopy(matrix), v0)

        distance = ls_res[0]
        path = ls_res[1]
        print(distance)
        print(path)

        ways = ls.get_ways(v0, v1, path)
        print(ways)

        if len(ways) == 2:
            print('ssss')

        if type(ways) == 'NoneType':
            self.createError()
            return

        self.createWays(ways)
        drawNetwork.drawResult(ways)
        self.createPhoto()