swingutils.threads.swing

Functions for running code in the Event Dispatch Thread.

swingutils.threads.swing.callSwing(func, *args, **kwargs)

Runs the given function in the Event Dispatch Thread. If this is invoked inside the EDT, the given function will be run normally. Otherwise, it’ll be queued to be run and the calling thread will block until the function has been executed.

Returns:func’s return value
swingutils.threads.swing.runSwing(func, *args, **kwargs)

Runs the given function in the Event Dispatch Thread. If this is invoked inside the EDT, the given function will be run normally. Otherwise, it’ll be queued to be run later. The return value from the target function will not be available.

Returns:None
swingutils.threads.swing.runSwingLater(func, *args, **kwargs)

Queues the given task to be run in the Event Dispatch Thread, regardless of whether the calling thread is the EDT itself.

swingutils.threads.swing.swingCall(func)

This is a decorator wrapper for callSwing().

This causes the wrapped function to be executed in the event dispatch thread. The calling thread will block until the function has finished executing. If the target function is called from the event dispatch thread, it will be executed directly.

swingutils.threads.swing.swingRun(func)

This is a decorator wrapper for runSwing().

This causes the wrapped function to be executed in the Event Dispatch Thread. If the target function is called from the EDT, it will be executed directly. Otherwise, it’ll be queued to be run later. The return value from the wrapped function will not be available.

swingutils.threads.swing.swingRunLater(func)

This is a decorator wrapper for runSwingLater().

This causes the wrapped function to be queued for execution in the Event Dispatch Thread. The call returns immediately, regardless of which thread it was made from.