def onViewCGClick(self): """function to call plotGraph to draw chordal graph""" if self.H: self.ag.plotGraph(self.ag.H, 2) else: tkinter.showwarning( "Warning", "Create Chordal Graph first to view Chordal Graph.") return
def onViewAGClick(self): """function to call plotGraph to draw arbitrary graph""" if self.G: self.ag.plotGraph(self.ag.G, 1) else: tkinter.showwarning( "Warning", "Create Arbitrary Graph first to view Arbitrary Graph.") return
def onCreateCGClick(self): """function to call createCG""" if self.G: self.ag.createCG() self.H = True else: tkinter.showwarning( "Warning", "Create Arbitrary Graph first before create Chordal Graph.") return
def open_file(event=None): global file_name file_name = filedialog.askopenfilename(initialdir=os.getcwd(), title="Select file", filetype=(('Text file', '*.txt'), ('all file', '*.*'))) try: with open(file_name, 'r') as fr: text_editor.delete(1.0, tk.END) text_editor.insert(1.0, fr.read()) except FileNotFoundError: tk.showwarning(title="warning", message="file is not found") except: tk.showerror(title="error", message="error") win.title(os.path.basename(file_name))
def show_warning(title, mssg): """ Implements a pop-up Window that Notifies the User of an error/warning """ tk.showwarning(title, mssg)
cansRew.place(x=440, y=340) cansRewRes = tk.Label(window, text=P + "0.00", bg="white", width=16, height=1, font=('times', 15, 'bold')) cansRewRes.place(x=590, y=340) #funtions while ser.in_waiting(): inbytes = ser.readline().decode('ascii') splitMat = inbytes.split(x) if (inbytes == "liq"): msgBoxwarn1 = tk.showwarning( 'Liquid Detected', 'Liquid is detected in the bottle/can. Please empty the bottle/can first and insert again.' ) if (splitMat[0] == "p"): pBottCount += 1 totalPBW = totalPBW + splitMat[1] percW = totalPBW / baseW a = basePr * percW totalRewardPb = totalRewardPb + a numBottRes.configure(text=str(pBottCount)) bottWRes.configure(text=str(totalPBW)) bottRewRes.configure(text=str(round(totalRewardPb))) if (splitMat[0] == "c"): canCount = +1 totalCW = totalCW + splitMat[1] percW = totalCW / baseW a = basePr * baseW
def onCreateAGClick(self): """function to check valid input and to create arbitrary Graph""" noNodes = self.nodesEntry.get() if isStrInt(noNodes): noNodes = int(self.nodesEntry.get()) if (noNodes < 4): tkinter.showwarning("Warning", "Entry for nodes is less than 4.") return else: tkinter.showwarning("Warning", "Entry for nodes is not an integer.") return noEdges = self.edgesEntry.get() if isStrInt(noEdges): noEdges = int(self.edgesEntry.get()) if (noEdges < 3): tkinter.showwarning("Warning", "Entry for edges is less than 3.") return if (noEdges < (noNodes - 1)): tkinter.showwarning( "Warning", "Entry for edges must be enough for a tree structure. Needs %d." % (noNodes - 1)) return if (noEdges > (noNodes * (noNodes - 1)) / 2): tkinter.showwarning( "Warning", "Entry for edges provided is more than a complete graph.") return else: tkinter.showwarning("Warning", "Entry for edges is not an integer.") return self.ag = CG.ChordalGraph(noNodes, noEdges) self.ag.createAG() self.G = True
def fare1(): v1=IntVar() v2=IntVar() v1=var.get() v2=var1.get() if v1=="bh-1" and v2=="unimall": fare2=30 return fare2 elif v1=="bh-1" and v2=="administrative": fare2=20 return fare2 elif v1=="bh-1" and v2=="bh-3": fare2=15 return fare2 elif v1=="bh-1" and v2=="maingate": fare2=80 return fare2 elif v1=="bh-1" and v2=="gh-6": fare2=40 return fare2 elif v1=="bh-6" and v2=="unimall": fare2=45 return fare2 elif v1=="bh-6" and v2=="administrative": fare2=30 return fare2 elif v1=="bh-6" and v2=="bh-3": fare2=15 return fare2 elif v1=="bh-6" and v2=="maingate": fare2=100 return fare2 elif v1=="bh-6" and v2=="gh-6": fare2=25 return fare2 elif v1=="bh-2" and v2=="unimall": fare2=20 return fare2 elif v1=="bh-2" and v2=="administrative": fare2=15 return fare2 elif v1=="bh-2" and v2=="bh-3": fare2=10 return fare2 elif v1=="bh-2" and v2=="maingate": fare2=90 return fare2 elif v1=="bh-2" and v2=="gh-6": fare2=45 return fare2 elif v1=="unimall" and v2=="administrative": fare2=10 return fare2 elif v1=="unimall" and v2=="bh-3": fare2=25 return fare2 elif v1=="unimall" and v2=="maingate": fare2=55 return fare2 elif v1=="unimall" and v2=="gh-6": fare2=20 return fare2 elif v1=="maingate" and v2=="unimall": fare2=36 return fare2 elif v1=="maingate" and v2=="administrative": fare2=65 return fare2 elif v1=="maingate" and v2=="bh-3": fare2=86 return fare2 elif v1=="maingate" and v2=="gh-6": fare2=64 return fare2 elif v1==v2: tkMessageBox.showwarning("ucab","please enter different origin and destination places")