Skip to main content

Enable use of threads with tkinter

Project description

tkthread - Enable threads to interact with tkinter

Tk (in Python, tkinter) is not thread-safe. It's not possible to interact with a tkinter UI from a thread other than the one in which it is running its event loop.

There are a number of workarounds, but they generally boil down to doing some sort of polling, which either introduces delays, or is wasteful of CPU resource.

This package provides a 'bridge' between threads and tkinter that does not suffer from either of these problems; threads can run freely, and can schedule operations to be performed on a tkinter UI. Those operations will be picked up with minimal delay and executed asynchronously with the threads, but without incurring any polling cost.

The examples provided demonstrate the difference in CPU cost between a 'polling' solution and the one provided by this package.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release. See tutorial on generating distribution archives.

Built Distribution

rjgtoys_tkthread-0.0.1-py3-none-any.whl (5.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page