Created
April 30, 2014 07:23
-
-
Save nulldatamap/8cfe05ece289c3513e90 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Importere vaerktoejer | |
| from Tkinter import * | |
| import time | |
| #Tiden | |
| startTime = 0 # predefine for later use | |
| endTime = 0 | |
| deltaTime = 0 | |
| #Definitioner | |
| def myClickMe1(): | |
| global startTime, endTime, deltaTime | |
| endTime = time.time(); | |
| deltaTime = endTime - startTime | |
| startTime = time.time(); # Restart the timer | |
| label1["text"] = '{0:.2f}'.format(deltaTime) | |
| print('{0:.2f}'.format(deltaTime)) | |
| #rod defineres | |
| window=Tk() | |
| #Vinduet | |
| window.geometry("700x800") | |
| window.title("Reaktionshastighehs test") | |
| #Labels | |
| label1=Label(window, text="Klik nu!") | |
| #indstillinger til objekter | |
| button1=Button(window, text="Klik her!", command=myClickMe1) | |
| #Placering af objekter | |
| button1.place(x=330, y=460) | |
| label1.place(x=335,y=500) | |
| # Make the timer tick: | |
| startTime = time.time(); # Get's the current time in seconds since epoc | |
| window.mainloop(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment