Created
April 30, 2014 08:07
-
-
Save nulldatamap/cff1b9db196e76f2a289 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 | |
| def spawn_button(): | |
| global startTime | |
| button1=Button(window, text="Klik her!", command=my_click_me1) | |
| button1.place(x=330, y=460) | |
| startTime = time.time(); | |
| #Definitioner | |
| def my_click_me1(): | |
| global startTime, endTime, deltaTime | |
| endTime = time.time(); | |
| deltaTime = endTime - startTime | |
| startTime = time.time(); # Restart the timer | |
| label1.place(x=335,y=500) | |
| 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!") | |
| # Make the timer tick: | |
| window.after( 5000, spawn_button ); | |
| window.mainloop(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment