コード例 #1
0
	def addwindow(self):
		"""Command of the "Add Window" option in "Window" menu.
		Creates a Window object to support window creation.
		"""
		
		newwindow = Window(self)
		newwindow.config()
コード例 #2
0
ファイル: QuickHull.py プロジェクト: liangtianumich/QuickHull
	def onExit(self):  #Window popup signaling that the Quick Hull is complete
		alert = Tk()
		finish = Window(alert)
		finish.config(title="Complete",w = 200, h=50)
		finish.positionWindow()

		done = Label(alert,text="QuickHull Complete")
		done.pack()

		ok = Button(alert,text="OK",command=alert.destroy)
		ok.pack()
		alert.mainloop()
		return
コード例 #3
0
    def onExit(self):  #Window popup signaling that the Quick Hull is complete
        alert = Tk()
        finish = Window(alert)
        finish.config(title="Complete", w=200, h=50)
        finish.positionWindow()

        done = Label(alert, text="QuickHull Complete")
        done.pack()

        ok = Button(alert, text="OK", command=alert.destroy)
        ok.pack()
        alert.mainloop()
        return
コード例 #4
0
ファイル: interface.py プロジェクト: kyupark/ML
def displayResult(result):
	alert = Tk();
	popup = Window(alert)
	popup.config(title = "Number:", w=150, h=90)
	popup.positionWindow()

	def onExit():
		alert.destroy()
		return

	okButton = Button(alert, text = "Ok", command = onExit)
	printOut = Label(alert, text = result)
	printOut.pack()
	okButton.pack()

	alert.mainloop()
コード例 #5
0
ファイル: main.py プロジェクト: yazici/QuickHull
	def getFile():

		AskFile = Tk()

		fileWindow = Window(AskFile)
		fileWindow.config(title="Import...", w=200, h=100)
		fileWindow.positionWindow(fileWindow.TOPLEFT)

		ask = Label(AskFile, text = "What file would you like to import? ")
		ask.place(x=10,y=25)

		style = Style()
		style.configure("BW.TEntry", foreground="black", background="white")

		text = Entry(AskFile,width=29,style="BW.TEntry")  #Create Text Box
		text.place(x=10,y=45)
		text.focus_set()

		def readin(): #Call back to get text, open the file, and close the window
			try:
				print ("Loading file...")
				filename = text.get()
				if(filename==""):
					filename = "test.txt"		#uses test as default entry
				data = open(filename)
				points = [[int(x) for x in line.split()] for line in data] # takes a each point in as: x y 

				fileWindow.onExit()
			except IOError:
				print ("Could not read the specified file")
			finally:
				print("Closing Import...")
				start(points) #Start QuickHull process

		ok = Button(AskFile,width=10, text="OK", command=readin)
		ok.place(x=70,y=70)
		fileWindow.startLoop() 
コード例 #6
0
ファイル: main.py プロジェクト: yazici/QuickHull
def startWindow():
	points = []
	Panel = Tk()

	mainWindow = Window(Panel)
	mainWindow.config(title = "QuickHull Menu",h=150,w=200)
	mainWindow.positionWindow(mainWindow.TOPLEFT)
	
	#start adding points
	def start(points = []):
		mainWindow.onExit()
		QuickHull(points) #Start QuickHull process
		mainWindow.mainloop();
	def exportData():
		return
	#Export points to csv

	def getFile():

		AskFile = Tk()

		fileWindow = Window(AskFile)
		fileWindow.config(title="Import...", w=200, h=100)
		fileWindow.positionWindow(fileWindow.TOPLEFT)

		ask = Label(AskFile, text = "What file would you like to import? ")
		ask.place(x=10,y=25)

		style = Style()
		style.configure("BW.TEntry", foreground="black", background="white")

		text = Entry(AskFile,width=29,style="BW.TEntry")  #Create Text Box
		text.place(x=10,y=45)
		text.focus_set()

		def readin(): #Call back to get text, open the file, and close the window
			try:
				print ("Loading file...")
				filename = text.get()
				if(filename==""):
					filename = "test.txt"		#uses test as default entry
				data = open(filename)
				points = [[int(x) for x in line.split()] for line in data] # takes a each point in as: x y 

				fileWindow.onExit()
			except IOError:
				print ("Could not read the specified file")
			finally:
				print("Closing Import...")
				start(points) #Start QuickHull process

		ok = Button(AskFile,width=10, text="OK", command=readin)
		ok.place(x=70,y=70)
		fileWindow.startLoop() 

	menubar = Menu(Panel)
	Panel.config(menu=menubar)

	fileMenu = Menu(menubar)
	#fileMenu.add_command(label="Start", command = start)

	fileMenu.add_command(label="Import...", command = getFile)
	fileMenu.add_command(label="Exit", command = mainWindow.onExit)
	menubar.add_cascade(label="File",menu=fileMenu)

	SButton = Button(Panel, text = "Start", command = start)
	SButton.pack()

	mainWindow.startLoop()