def __init__(self, parent): Tkinter.Tk.__init__(self, parent) self.parent = parent self.initialize() self.tree = SCG.StronglyChordalGraph(0, 0) self.CG = False self.SCG = False
def onCreateTrampolinesClick(self): """function to call createCG""" noNodes = self.nodesEntry.get() nodesList = noNodes.split(",") #if isStrInt(noNodes): #noNodes = int (self.nodesEntry.get()) #if (noNodes < 0): #tkMessageBox.showwarning("Warning","Entry for nodes is less than 0.") #return #else: #tkMessageBox.showwarning("Warning","Entry for nodes is not an integer.") #return #noEdges = self.edgesEntry.get() #if isStrInt(noEdges): #noEdges = int (self.edgesEntry.get()) #if (noEdges < 0): #tkMessageBox.showwarning("Warning","Entry for edges is less than 0.") #return #if (noEdges < (noNodes-1)): #tkMessageBox.showwarning("Warning","Entry for edges must be enough for a tree structure. Needs %d." %(noNodes-1)) #return #if (noEdges > (noNodes*(noNodes-1))/2) : #tkMessageBox.showwarning("Warning","Entry for edges provided is more than a complete graph." ) #return #else: #tkMessageBox.showwarning("Warning","Entry for edges is not an integer.") #return #self.tree = SCG.StronglyChordalGraph(nodesList, noEdges) self.tree = SCG.StronglyChordalGraph(nodesList, 0) self.CG = self.tree.createTrampolines()
def onCreateCGClick(self): """function to call createCG""" noNodes = self.nodesEntry.get() if isStrInt(noNodes): noNodes = int (self.nodesEntry.get()) if (noNodes < 0): tkMessageBox.showwarning("Warning","Entry for nodes is less than 0.") return else: tkMessageBox.showwarning("Warning","Entry for nodes is not an integer.") return noEdges = self.edgesEntry.get() if isStrInt(noEdges): noEdges = int (self.edgesEntry.get()) if (noEdges < 0): tkMessageBox.showwarning("Warning","Entry for edges is less than 0.") return if (noEdges < (noNodes-1)): tkMessageBox.showwarning("Warning","Entry for edges must be enough for a tree structure. Needs %d." %(noNodes-1)) return if (noEdges > (noNodes*(noNodes-1))/2) : tkMessageBox.showwarning("Warning","Entry for edges provided is more than a complete graph." ) return else: tkMessageBox.showwarning("Warning","Entry for edges is not an integer.") return self.tree = SCG.StronglyChordalGraph(noNodes, noEdges) self.CG = self.tree.createCG()