本文整理匯總了Python中Solver.find_intersect方法的典型用法代碼示例。如果您正苦於以下問題:Python Solver.find_intersect方法的具體用法?Python Solver.find_intersect怎麽用?Python Solver.find_intersect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Solver
的用法示例。
在下文中一共展示了Solver.find_intersect方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: GUI
# 需要導入模塊: import Solver [as 別名]
# 或者: from Solver import find_intersect [as 別名]
class GUI(object):
"""description of class"""
def __init__(self,master):
# aanmaak list voor de ingelezen cirkels
self.cirkels = []
# de parent van deze GUI = root
self.master = master
# bottom en top frames om zo de layout wat te verbeteren
self.top = Frame(master, bd=1,relief=SUNKEN,padx=1,pady=1)
self.bottom = Frame(master, bd=1,relief=SUNKEN,padx=1,pady=1)
self.top.pack(side=TOP,fill=BOTH, expand=True)
self.bottom.pack(side=BOTTOM, fill=BOTH, expand=True)
# top in nog meer frames opdelen links en rechts
self.leftTOP = Frame(self.top, bd=1,relief=SUNKEN,padx=1,pady=1)
self.rightTOP = Frame(self.top, bd=1,relief=SUNKEN,padx=1,pady=1)
self.leftTOP.pack(side=LEFT,fill=BOTH, expand=True)
self.rightTOP.pack(side=RIGHT,fill=BOTH, expand=True)
# uitleg
w = Label(self.rightTOP, text="Enter the path to to input file in the first field or use the browse input button"+"\n" +"Enter the path to the output file in the second field or use the browse output button" + "\n" + "push the START button to start processing")
w.pack()
# buttons
self.buttontext = StringVar()
self.buttontext.set("START")
self.startbutton = Button(master, textvariable=self.buttontext, command=self.clicked1,height = 2)
self.buttontext1 = StringVar()
self.buttontext1.set("Browse input")
self.browsebutton = Button(master, textvariable=self.buttontext1,command=self.clicked2, height = 1)
self.buttontext2 = StringVar()
self.buttontext2.set("Browse output")
self.browsebutton1 = Button(master, textvariable=self.buttontext2,command=self.clicked3, height = 1)
self.startbutton.pack(in_= self.rightTOP)
self.browsebutton.pack(in_= self.leftTOP)
self.browsebutton1.pack(in_=self.leftTOP)
self.inputframe = Frame(master,width=500, height=500, bd=1,relief=SUNKEN,padx=1,pady=1,bg="blue")
self.inputframe.pack(in_= self.bottom, side = LEFT)
self.outputframe = Frame(master,width=500, height=500, bd=1,relief=SUNKEN,padx=1,pady=1,bg="blue")
self.outputframe.pack(in_= self.bottom, side = LEFT)
#entry fields
self.entrytext = StringVar()
self.inputEntry = Entry(master, textvariable=self.entrytext, width = 50).pack(in_= self.leftTOP)
self.entrytext1 = StringVar()
self.outputEntry = Entry(master, textvariable=self.entrytext1, width = 50).pack(in_= self.leftTOP)
def output(self, path):
if len(path) > 4 :
file = open(path,'w')
if (self.algo == 3):
file.write("Dit Algoritme is niet ge"+"\i"+"mplementeerd")
file.close()
else:
for inter in self.intersections[0]:
file.write(inter.to_string()+"\n")
file.write("\n" )
file.write("uitvoeringstijd in ms: " + str(self.intersections[1]))
file.close()
def process(self,path):
count = 0
path = path.replace("\"", "")
self.algo = 1
for line in fileinput.input(files = (path)):
if count == 0:
self.algo = int(line[0])
else:
if " " in line:
cir = line.split( ' ' , 2)
pos = Position( float(cir[0]), float(cir[1]))
cir = Circle( pos , float(cir [2]))
self.cirkels.append(cir)
count = count + 1
self.solver = Solver(self.algo, self.cirkels)
self.intersections = self.solver.find_intersect()
self.intersections[1] = self.intersections[1]*1000
def clicked1(self):
self.process(self.entrytext.get())
self.output(self.entrytext1.get())
self.algoLabel = Label(self.master,text = "Het gebruikte algoritme is: " + str(self.algo))
self.algoLabel.pack(in_= self.rightTOP)
self.timeLabel = Label(self.master,text = "Het vinden van de snijpunten nam: " + str(self.intersections[1]) + " ms in beslag")
self.timeLabel.pack(in_= self.rightTOP)
cirkeltext = Text(self.inputframe)
cirkeltext.insert(END,'Uw Cirkels:')
#.........這裏部分代碼省略.........