On this page you will find what you are looking for http://www.pygame.org/docs/ref/time.html#pygame.time.get_ticks
You download ticks once before beginning the countdown (which can be a trigger in the game – the key event, whatever). For example:
start_ticks=pygame.time.get_ticks() #starter tick while mainloop: # mainloop seconds=(pygame.time.get_ticks()-start_ticks)/1000 #calculate how many seconds if seconds>10: # if more than 10 seconds close the game break print (seconds) #print how many seconds
Related Posts:
- Process finished with exit code -1073741515 (0xC0000135)
- ImportError: No module named ‘pygame’
- ImportError: No module named ‘pygame’
- pygame.error: video system not initialized
- pygame.error: video system not initialized
- How to draw a circle in PyGame?
- pygame.error: video system not initialized
- TypeError: object of type ‘int’ has no len() – Python/Pygame
- Pygame Drawing a Rectangle
- How do I detect collision in pygame?
- How to display text in pygame?
- How to get keyboard input in pygame?
- pygame clock.tick() vs framerate in game main loop
- Start with pyglet or pygame?
- Pygame mouse clicking detection
- How can I create a text input box with Pygame?
- How do I maximize the display screen in PyGame?
- How to install PyGame on Python 3.4?
- How to use pygame.KEYDOWN to execute something every time through a loop while the key is held down?
- How to clear up screen in pygame?
- Installation of pygame with Anaconda
- How do I rotate an image around its center using Pygame?
- How to add a background image into pygame?
- How to read a file line-by-line into a list?
- How do I sort a dictionary by value?
- TypeError: only size-1 arrays can be converted to Python scalars (matplotlib)
- Why do I get TypeError: can’t multiply sequence by non-int of type ‘float’?
- Writing a pandas DataFrame to CSV file
- How do I check if a variable exists?
- Is there a label/goto in Python?
- Why do I get “Pickle – EOFError: Ran out of input” reading an empty file?
- Getting TypeError: __init__() missing 1 required positional argument: ‘on_delete’ when trying to add parent table after child table with entries
- Python Pandas Counting the Occurrences of a Specific value
- What does the c underscore expression `c_` do exactly?
- Count unique values per groups with Pandas
- Get unique values from a list in python [duplicate]
- How do you decode Base64 data in Python?
- Convert pandas Series to DataFrame
- TypeError: ‘type’ object is not subscriptable when indexing in to a dictionary
- Error: all the input array dimensions except for the concatenation axis must match exactly
- Expected 2D array, got 1D array instead error
- How to prevent errno 32 broken pipe?
- The equivalent of a GOTO in python [duplicate]
- tkinter gui with progress bar
- How does Python’s super() work with multiple inheritance?
- How can the Euclidean distance be calculated with NumPy?
- Tkinter understanding mainloop
- Embedding in pytorch
- Check string “None” or “not” in Python 2.7
- re.search().TypeError: cannot use a string pattern on a bytes-like object
- Cannot uninstall Tensorflow
- Add Legend to Seaborn point plot
- Get key by value in dictionary
- How to add multiple values to a dictionary key in python?
- Where can I find a list of the Flask SQLAlchemy Column types and options?
- How can I install Python’s pip3 on my Mac?
- convert json ipython notebook(.ipynb) to .py file
- how to update spyder on anaconda
- Can’t broadcast input array from shape (3,1) into shape (3,)
- How to create an array of bits in Python?
- Setting Django up to use MySQL
- In Python, when to use a Dictionary, List or Set?
- How can I check for NaN values?
- Python – how to use the constant e^
- Check if two unordered lists are equal
- Multiple assignment and evaluation order in Python
- deleting rows in numpy array
- How to make a 3D scatter plot in matplotlib
- Arrays used as indices must be of integer (or boolean) type
- Is there a list of Pytz Timezones?
- Flask example with POST
- How do I change the figure size with subplots?
- Clear terminal in Python [duplicate]
- ModuleNotFoundError: No module named ‘discord’
- No numeric types to aggregate – change in groupby() behaviour?
- Easy pretty printing of floats?
- Algorithm for solving Sudoku
- How to read pickle file?
- Euclidean Algorithm / GCD in Python
- Python Socket Receive Large Amount of Data
- What is a “slug” in Django?
- Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll
- if else function in pandas dataframe
- Primality test in python [duplicate]
- Flask-SQLalchemy update a row’s information
- Inline for loop
- Simple way to create matrix of random numbers
- pandas: multiple conditions while indexing data frame – unexpected behavior
- ‘instancemethod’ object has no attribute ‘__getitem__’ with class variables
- Python/Scikit-Learn – Can’t handle mix of multiclass and continuous
- Sorting list of lists by the first element of each sub-list
- Install py2exe for python 2.7 over pip: this package requires Python 3.3 or later
- What is the correct format to write float value to file in Python
- bash: syntax error near unexpected token `(‘ – Python
- Find all files in a directory with extension .txt in Python
- “public” or “private” attribute in Python ? What is the best way?
- How to search for a string in text files?
- TypeError: ‘zip’ object is not subscriptable
- Pip: could not find a version. No matching distribution found
- Compare two columns using pandas