Measure elapsed time in Swift

Here’s a Swift function I wrote to measure Project Euler problems in Swift As of Swift 3, there is now a version of Grand Central Dispatch that is “swiftified”. So the correct answer is probably to use the DispatchTime API. My function would look something like: // Swift 3 func evaluateProblem(problemNumber: Int, problemBlock: () -> … Read more

tkinter and time.sleep

You really should be using something like the Tkinter after method rather than time.sleep(…). There’s an example of using the after method at this other stackoverflow question. Here’s a modified version of your script that uses the after method: from time import time, sleep from Tkinter import * def empty_textbox(): textbox.delete(“1.0”, END) root = Tk() … Read more