Source

pygame / doc / src / sdltime.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE module SYSTEM "api.dtd">

<module name="pygame2.sdl.time">
  <short>SDL time handling and measurement wrapper module</short>
  <desc>SDL time handling and measurement wrapper module.
  </desc>

  <func name="add_timer">
    <call>add_timer (interval, callable[, data]) -> CObject</call>
    <desc>
      Adds a timer callback to be called periodically.
      
      Adds a timer callback to be called periodically using the specified
      *interval*. *callable* can be any callable objet, method or function.
      On invocation, the optional *data* will be passed to the callable. If
      *data* is a sequence, each item of it will be passed as single argument
      to tha callable.
            
      This will return an CObject that acts as unique id for the timer callback.

      .. note::
      
        Timer callbacks will be invoked from a seperate thread, if the
        underlying SDL library can use threads. In those cases, the
        invoked callback will lock the interpreter instance, execute and
        release the lock. This in turn means that your callback must
        take care of not locking itself in order to wait for another
        function or thread to be executed within the same interpreter
        instance. Otherwise you can run into a classic dead lock
        situation.

        Any added timer will be removed automatically on calling :func:`quit`.
    </desc>
  </func>
  <func name="delay">
    <call>delay (time) -> None</call>
    <desc>
      Delays the execution for a specific time.
      
      Delays the program execution for a specific *time*. The *time* is
      expressed in milliseconds.

      .. note::

        This does *not* require :func:`init` to be called before.
    </desc>
  </func>
  <func name="get_ticks">
    <call>get_ticks () -> long</call>
    <desc>
      Gets the number of milliseconds since the initialization of the underlying
      SDL library.
      
      Gets the number of milliseconds since the initialization of the underlying
      SDL library. The value will wrap if the program runs for more than ~49
      days.
    </desc>
  </func>
  <func name="init">
    <call>init () -> None</call>
    <desc>
      Initializes the timer subsystem of the SDL library.
    </desc>
  </func>
  <func name="quit">
    <call>quit () -> None</call>
    <desc>
      Shuts down the timer subsystem of the SDL library.

      After calling this function, you should not invoke any class,
      method or function related to the timer subsystem as they are
      likely to fail or might give unpredictable results.
      
      .. note::
      
        Any timer set by :func:`set_timer` or :func:`add_timer` will be removed
        automatically on calling :func:`quit`.
    </desc>
  </func>
  <func name="remove_timer">
    <call>remove_timer (timerobj) -> None</call>
    <desc>
      Removes a previously added timer callback.
      
      Removes a previously added timer callback and throws an exception, if the
      passed object is not a matching timer object.
    </desc>
  </func>
  <func name="was_init">
    <call>was_init () -> bool</call>
    <desc>
      Returns, whether the timer subsystem of the SDL library is initialized.
    </desc>
  </func>
</module>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.