PythonTask

from panda3d.core import PythonTask
class PythonTask

Bases:

Bases: AsyncTask

This class exists to allow association of a Python function or coroutine with the AsyncTaskManager.

Inheritance diagram

Inheritance diagram of PythonTask

__clear__() int
__delattr__(attr: object) int
property __dict__

This is a special variable to hold the instance dictionary in which custom variables may be stored.

getter/setter for PyObject *PythonTask::__dict__;

__getattr__(attr: object) object
__init__(function: object, name: str)
__init__(param0: PythonTask)
__setattr__(attr: object, v: object) int
__traverse__(visit: visitproc, arg: panda3d._rplight.void) int
property delayTime float

Alias of delay_time.

Getter

Returns the delay value that has been set via setDelay(), if any.

Returns the delay value that has been set via setDelay(), if any.

Setter

Specifies the amount of time, in seconds, by which this task will be delayed after it has been added to the AsyncTaskManager. At least the specified amount of time (and possibly more) will elapse before the task begins.

You may specify a delay of 0.0 to guarantee that the task will run in the next epoch following the one in which it is added.

Setting this value after the task has already been added will not affect the task’s wake time; it will only affect the task if it is re-added to the queue in the future, for instance if the task returns DS_again. However, see recalcWakeTime() if you wish to apply the delay effect immediately.

Specifies the amount of time, in seconds, by which this task will be delayed after it has been added to the AsyncTaskManager. At least the specified amount of time (and possibly more) will elapse before the task begins.

You may specify a delay of 0.0 to guarantee that the task will run in the next epoch following the one in which it is added.

Setting this value after the task has already been added will not affect the task’s wake time; it will only affect the task if it is re-added to the queue in the future, for instance if the task returns DS_again. However, see recalcWakeTime() if you wish to apply the delay effect immediately.

property delay_time float

The delay value that has been set on this task, if any, or None.

Getter

Returns the delay value that has been set via setDelay(), if any.

Returns the delay value that has been set via setDelay(), if any.

Setter

Specifies the amount of time, in seconds, by which this task will be delayed after it has been added to the AsyncTaskManager. At least the specified amount of time (and possibly more) will elapse before the task begins.

You may specify a delay of 0.0 to guarantee that the task will run in the next epoch following the one in which it is added.

Setting this value after the task has already been added will not affect the task’s wake time; it will only affect the task if it is re-added to the queue in the future, for instance if the task returns DS_again. However, see recalcWakeTime() if you wish to apply the delay effect immediately.

Specifies the amount of time, in seconds, by which this task will be delayed after it has been added to the AsyncTaskManager. At least the specified amount of time (and possibly more) will elapse before the task begins.

You may specify a delay of 0.0 to guarantee that the task will run in the next epoch following the one in which it is added.

Setting this value after the task has already been added will not affect the task’s wake time; it will only affect the task if it is re-added to the queue in the future, for instance if the task returns DS_again. However, see recalcWakeTime() if you wish to apply the delay effect immediately.

property frame int

The number of frames that have elapsed since the task was started, according to the task manager’s clock.

Returns the number of frames that have elapsed since the task was started, according to the task manager’s clock.

It is only valid to call this if the task’s status is not S_inactive.

getArgs() object
static getClassType() TypeHandle
getFunction() object

Returns the function that is called when the task runs.

getOwner() object

Returns the “owner” object. See setOwner().

getUponDeath() object

Returns the function that is called when the task finishes.

operatorNew(size: int)
setArgs(args: object, append_task: bool)
setFunction(function: object)
setOwner(owner: object)
setResult(result: object)

Sets the “result” of this task. This is the value returned from an “await” expression on this task. This can only be called while the task is still alive.

setUponDeath(upon_death: object)
property time float

The amount of seconds that have elapsed since the task was started, according to the task manager’s clock.

Returns the amount of time that has elapsed since the task was started, according to the task manager’s clock.

It is only valid to call this if the task’s status is not S_inactive.

property wakeTime float

Alias of wake_time.

If this task has been added to an AsyncTaskManager with a delay in effect, this returns the time at which the task is expected to awaken. It has no meaning if the task has not yet been added to a queue, or if there was no delay in effect at the time the task was added.

If the task’s status is not S_sleeping, this returns 0.0.

If this task has been added to an AsyncTaskManager with a delay in effect, this returns the time at which the task is expected to awaken. It has no meaning if the task has not yet been added to a queue, or if there was no delay in effect at the time the task was added.

If the task’s status is not S_sleeping, this returns 0.0.

property wake_time float

If this task has been added to an AsyncTaskManager with a delay in effect, this contains the time at which the task is expected to awaken. It has no meaning of the task has not yet been added to a queue, or if there was no delay in effect at the time the task was added. If the task’s status is not S_sleeping, this contains 0.0.

If this task has been added to an AsyncTaskManager with a delay in effect, this returns the time at which the task is expected to awaken. It has no meaning if the task has not yet been added to a queue, or if there was no delay in effect at the time the task was added.

If the task’s status is not S_sleeping, this returns 0.0.

If this task has been added to an AsyncTaskManager with a delay in effect, this returns the time at which the task is expected to awaken. It has no meaning if the task has not yet been added to a queue, or if there was no delay in effect at the time the task was added.

If the task’s status is not S_sleeping, this returns 0.0.