doc_content stringlengths 1 386k | doc_id stringlengths 5 188 |
|---|---|
class threading.Event
Class implementing event objects. An event manages a flag that can be set to true with the set() method and reset to false with the clear() method. The wait() method blocks until the flag is true. The flag is initially false. Changed in version 3.3: changed from a factory function to a class. ... | python.library.threading#threading.Event |
clear()
Reset the internal flag to false. Subsequently, threads calling wait() will block until set() is called to set the internal flag to true again. | python.library.threading#threading.Event.clear |
is_set()
Return True if and only if the internal flag is true. | python.library.threading#threading.Event.is_set |
set()
Set the internal flag to true. All threads waiting for it to become true are awakened. Threads that call wait() once the flag is true will not block at all. | python.library.threading#threading.Event.set |
wait(timeout=None)
Block until the internal flag is true. If the internal flag is true on entry, return immediately. Otherwise, block until another thread calls set() to set the flag to true, or until the optional timeout occurs. When the timeout argument is present and not None, it should be a floating point number ... | python.library.threading#threading.Event.wait |
threading.excepthook(args, /)
Handle uncaught exception raised by Thread.run(). The args argument has the following attributes:
exc_type: Exception type.
exc_value: Exception value, can be None.
exc_traceback: Exception traceback, can be None.
thread: Thread which raised the exception, can be None. If exc_type ... | python.library.threading#threading.excepthook |
threading.get_ident()
Return the ‘thread identifier’ of the current thread. This is a nonzero integer. Its value has no direct meaning; it is intended as a magic cookie to be used e.g. to index a dictionary of thread-specific data. Thread identifiers may be recycled when a thread exits and another thread is created. ... | python.library.threading#threading.get_ident |
threading.get_native_id()
Return the native integral Thread ID of the current thread assigned by the kernel. This is a non-negative integer. Its value may be used to uniquely identify this particular thread system-wide (until the thread terminates, after which the value may be recycled by the OS). Availability: Windo... | python.library.threading#threading.get_native_id |
class threading.local
A class that represents thread-local data. For more details and extensive examples, see the documentation string of the _threading_local module. | python.library.threading#threading.local |
class threading.Lock
The class implementing primitive lock objects. Once a thread has acquired a lock, subsequent attempts to acquire it block, until it is released; any thread may release it. Note that Lock is actually a factory function which returns an instance of the most efficient version of the concrete Lock cl... | python.library.threading#threading.Lock |
acquire(blocking=True, timeout=-1)
Acquire a lock, blocking or non-blocking. When invoked with the blocking argument set to True (the default), block until the lock is unlocked, then set it to locked and return True. When invoked with the blocking argument set to False, do not block. If a call with blocking set to Tr... | python.library.threading#threading.Lock.acquire |
locked()
Return true if the lock is acquired. | python.library.threading#threading.Lock.locked |
release()
Release a lock. This can be called from any thread, not only the thread which has acquired the lock. When the lock is locked, reset it to unlocked, and return. If any other threads are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. When invoked on an unlocked lock, a ... | python.library.threading#threading.Lock.release |
threading.main_thread()
Return the main Thread object. In normal conditions, the main thread is the thread from which the Python interpreter was started. New in version 3.4. | python.library.threading#threading.main_thread |
class threading.RLock
This class implements reentrant lock objects. A reentrant lock must be released by the thread that acquired it. Once a thread has acquired a reentrant lock, the same thread may acquire it again without blocking; the thread must release it once for each time it has acquired it. Note that RLock is... | python.library.threading#threading.RLock |
acquire(blocking=True, timeout=-1)
Acquire a lock, blocking or non-blocking. When invoked without arguments: if this thread already owns the lock, increment the recursion level by one, and return immediately. Otherwise, if another thread owns the lock, block until the lock is unlocked. Once the lock is unlocked (not ... | python.library.threading#threading.RLock.acquire |
release()
Release a lock, decrementing the recursion level. If after the decrement it is zero, reset the lock to unlocked (not owned by any thread), and if any other threads are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. If after the decrement the recursion level is still n... | python.library.threading#threading.RLock.release |
class threading.Semaphore(value=1)
This class implements semaphore objects. A semaphore manages an atomic counter representing the number of release() calls minus the number of acquire() calls, plus an initial value. The acquire() method blocks if necessary until it can return without making the counter negative. If ... | python.library.threading#threading.Semaphore |
acquire(blocking=True, timeout=None)
Acquire a semaphore. When invoked without arguments: If the internal counter is larger than zero on entry, decrement it by one and return True immediately. If the internal counter is zero on entry, block until awoken by a call to release(). Once awoken (and the counter is greater... | python.library.threading#threading.Semaphore.acquire |
release(n=1)
Release a semaphore, incrementing the internal counter by n. When it was zero on entry and other threads are waiting for it to become larger than zero again, wake up n of those threads. Changed in version 3.9: Added the n parameter to release multiple waiting threads at once. | python.library.threading#threading.Semaphore.release |
threading.setprofile(func)
Set a profile function for all threads started from the threading module. The func will be passed to sys.setprofile() for each thread, before its run() method is called. | python.library.threading#threading.setprofile |
threading.settrace(func)
Set a trace function for all threads started from the threading module. The func will be passed to sys.settrace() for each thread, before its run() method is called. | python.library.threading#threading.settrace |
threading.stack_size([size])
Return the thread stack size used when creating new threads. The optional size argument specifies the stack size to be used for subsequently created threads, and must be 0 (use platform or configured default) or a positive integer value of at least 32,768 (32 KiB). If size is not specifie... | python.library.threading#threading.stack_size |
class threading.Thread(group=None, target=None, name=None, args=(), kwargs={}, *, daemon=None)
This constructor should always be called with keyword arguments. Arguments are: group should be None; reserved for future extension when a ThreadGroup class is implemented. target is the callable object to be invoked by the... | python.library.threading#threading.Thread |
daemon
A boolean value indicating whether this thread is a daemon thread (True) or not (False). This must be set before start() is called, otherwise RuntimeError is raised. Its initial value is inherited from the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thr... | python.library.threading#threading.Thread.daemon |
getName()
setName()
Old getter/setter API for name; use it directly as a property instead. | python.library.threading#threading.Thread.getName |
ident
The ‘thread identifier’ of this thread or None if the thread has not been started. This is a nonzero integer. See the get_ident() function. Thread identifiers may be recycled when a thread exits and another thread is created. The identifier is available even after the thread has exited. | python.library.threading#threading.Thread.ident |
isDaemon()
setDaemon()
Old getter/setter API for daemon; use it directly as a property instead. | python.library.threading#threading.Thread.isDaemon |
is_alive()
Return whether the thread is alive. This method returns True just before the run() method starts until just after the run() method terminates. The module function enumerate() returns a list of all alive threads. | python.library.threading#threading.Thread.is_alive |
join(timeout=None)
Wait until the thread terminates. This blocks the calling thread until the thread whose join() method is called terminates – either normally or through an unhandled exception – or until the optional timeout occurs. When the timeout argument is present and not None, it should be a floating point num... | python.library.threading#threading.Thread.join |
name
A string used for identification purposes only. It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor. | python.library.threading#threading.Thread.name |
native_id
The native integral thread ID of this thread. This is a non-negative integer, or None if the thread has not been started. See the get_native_id() function. This represents the Thread ID (TID) as assigned to the thread by the OS (kernel). Its value may be used to uniquely identify this particular thread syst... | python.library.threading#threading.Thread.native_id |
run()
Method representing the thread’s activity. You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with positional and keyword arguments taken from the args and kwargs arguments, respectively. | python.library.threading#threading.Thread.run |
isDaemon()
setDaemon()
Old getter/setter API for daemon; use it directly as a property instead. | python.library.threading#threading.Thread.setDaemon |
getName()
setName()
Old getter/setter API for name; use it directly as a property instead. | python.library.threading#threading.Thread.setName |
start()
Start the thread’s activity. It must be called at most once per thread object. It arranges for the object’s run() method to be invoked in a separate thread of control. This method will raise a RuntimeError if called more than once on the same thread object. | python.library.threading#threading.Thread.start |
threading.TIMEOUT_MAX
The maximum value allowed for the timeout parameter of blocking functions (Lock.acquire(), RLock.acquire(), Condition.wait(), etc.). Specifying a timeout greater than this value will raise an OverflowError. New in version 3.2. | python.library.threading#threading.TIMEOUT_MAX |
class threading.Timer(interval, function, args=None, kwargs=None)
Create a timer that will run function with arguments args and keyword arguments kwargs, after interval seconds have passed. If args is None (the default) then an empty list will be used. If kwargs is None (the default) then an empty dict will be used. ... | python.library.threading#threading.Timer |
cancel()
Stop the timer, and cancel the execution of the timer’s action. This will only work if the timer is still in its waiting stage. | python.library.threading#threading.Timer.cancel |
time — Time access and conversions This module provides various time-related functions. For related functionality, see also the datetime and calendar modules. Although this module is always available, not all functions are available on all platforms. Most of the functions defined in this module call platform C library ... | python.library.time |
time.altzone
The offset of the local DST timezone, in seconds west of UTC, if one is defined. This is negative if the local DST timezone is east of UTC (as in Western Europe, including the UK). Only use this if daylight is nonzero. See note below. | python.library.time#time.altzone |
time.asctime([t])
Convert a tuple or struct_time representing a time as returned by gmtime() or localtime() to a string of the following form: 'Sun Jun 20 23:21:05 1993'. The day field is two characters long and is space padded if the day is a single digit, e.g.: 'Wed Jun 9 04:26:40 1993'. If t is not provided, the ... | python.library.time#time.asctime |
time.CLOCK_BOOTTIME
Identical to CLOCK_MONOTONIC, except it also includes any time that the system is suspended. This allows applications to get a suspend-aware monotonic clock without having to deal with the complications of CLOCK_REALTIME, which may have discontinuities if the time is changed using settimeofday() o... | python.library.time#time.CLOCK_BOOTTIME |
time.clock_getres(clk_id)
Return the resolution (precision) of the specified clock clk_id. Refer to Clock ID Constants for a list of accepted values for clk_id. Availability: Unix. New in version 3.3. | python.library.time#time.clock_getres |
time.clock_gettime(clk_id) → float
Return the time of the specified clock clk_id. Refer to Clock ID Constants for a list of accepted values for clk_id. Availability: Unix. New in version 3.3. | python.library.time#time.clock_gettime |
time.clock_gettime_ns(clk_id) → int
Similar to clock_gettime() but return time as nanoseconds. Availability: Unix. New in version 3.7. | python.library.time#time.clock_gettime_ns |
time.CLOCK_HIGHRES
The Solaris OS has a CLOCK_HIGHRES timer that attempts to use an optimal hardware source, and may give close to nanosecond resolution. CLOCK_HIGHRES is the nonadjustable, high-resolution clock. Availability: Solaris. New in version 3.3. | python.library.time#time.CLOCK_HIGHRES |
time.CLOCK_MONOTONIC
Clock that cannot be set and represents monotonic time since some unspecified starting point. Availability: Unix. New in version 3.3. | python.library.time#time.CLOCK_MONOTONIC |
time.CLOCK_MONOTONIC_RAW
Similar to CLOCK_MONOTONIC, but provides access to a raw hardware-based time that is not subject to NTP adjustments. Availability: Linux 2.6.28 and newer, macOS 10.12 and newer. New in version 3.3. | python.library.time#time.CLOCK_MONOTONIC_RAW |
time.CLOCK_PROCESS_CPUTIME_ID
High-resolution per-process timer from the CPU. Availability: Unix. New in version 3.3. | python.library.time#time.CLOCK_PROCESS_CPUTIME_ID |
time.CLOCK_PROF
High-resolution per-process timer from the CPU. Availability: FreeBSD, NetBSD 7 or later, OpenBSD. New in version 3.7. | python.library.time#time.CLOCK_PROF |
time.CLOCK_REALTIME
System-wide real-time clock. Setting this clock requires appropriate privileges. Availability: Unix. New in version 3.3. | python.library.time#time.CLOCK_REALTIME |
time.clock_settime(clk_id, time: float)
Set the time of the specified clock clk_id. Currently, CLOCK_REALTIME is the only accepted value for clk_id. Availability: Unix. New in version 3.3. | python.library.time#time.clock_settime |
time.clock_settime_ns(clk_id, time: int)
Similar to clock_settime() but set time with nanoseconds. Availability: Unix. New in version 3.7. | python.library.time#time.clock_settime_ns |
time.CLOCK_TAI
International Atomic Time The system must have a current leap second table in order for this to give the correct answer. PTP or NTP software can maintain a leap second table. Availability: Linux. New in version 3.9. | python.library.time#time.CLOCK_TAI |
time.CLOCK_THREAD_CPUTIME_ID
Thread-specific CPU-time clock. Availability: Unix. New in version 3.3. | python.library.time#time.CLOCK_THREAD_CPUTIME_ID |
time.CLOCK_UPTIME
Time whose absolute value is the time the system has been running and not suspended, providing accurate uptime measurement, both absolute and interval. Availability: FreeBSD, OpenBSD 5.5 or later. New in version 3.7. | python.library.time#time.CLOCK_UPTIME |
time.CLOCK_UPTIME_RAW
Clock that increments monotonically, tracking the time since an arbitrary point, unaffected by frequency or time adjustments and not incremented while the system is asleep. Availability: macOS 10.12 and newer. New in version 3.8. | python.library.time#time.CLOCK_UPTIME_RAW |
time.ctime([secs])
Convert a time expressed in seconds since the epoch to a string of a form: 'Sun Jun 20 23:21:05 1993' representing local time. The day field is two characters long and is space padded if the day is a single digit, e.g.: 'Wed Jun 9 04:26:40 1993'. If secs is not provided or None, the current time a... | python.library.time#time.ctime |
time.daylight
Nonzero if a DST timezone is defined. See note below. | python.library.time#time.daylight |
time.get_clock_info(name)
Get information on the specified clock as a namespace object. Supported clock names and the corresponding functions to read their value are:
'monotonic': time.monotonic()
'perf_counter': time.perf_counter()
'process_time': time.process_time()
'thread_time': time.thread_time()
'time... | python.library.time#time.get_clock_info |
time.gmtime([secs])
Convert a time expressed in seconds since the epoch to a struct_time in UTC in which the dst flag is always zero. If secs is not provided or None, the current time as returned by time() is used. Fractions of a second are ignored. See above for a description of the struct_time object. See calendar.... | python.library.time#time.gmtime |
time.localtime([secs])
Like gmtime() but converts to local time. If secs is not provided or None, the current time as returned by time() is used. The dst flag is set to 1 when DST applies to the given time. | python.library.time#time.localtime |
time.mktime(t)
This is the inverse function of localtime(). Its argument is the struct_time or full 9-tuple (since the dst flag is needed; use -1 as the dst flag if it is unknown) which expresses the time in local time, not UTC. It returns a floating point number, for compatibility with time(). If the input value can... | python.library.time#time.mktime |
time.monotonic() → float
Return the value (in fractional seconds) of a monotonic clock, i.e. a clock that cannot go backwards. The clock is not affected by system clock updates. The reference point of the returned value is undefined, so that only the difference between the results of two calls is valid. New in versi... | python.library.time#time.monotonic |
time.monotonic_ns() → int
Similar to monotonic(), but return time as nanoseconds. New in version 3.7. | python.library.time#time.monotonic_ns |
time.perf_counter() → float
Return the value (in fractional seconds) of a performance counter, i.e. a clock with the highest available resolution to measure a short duration. It does include time elapsed during sleep and is system-wide. The reference point of the returned value is undefined, so that only the differen... | python.library.time#time.perf_counter |
time.perf_counter_ns() → int
Similar to perf_counter(), but return time as nanoseconds. New in version 3.7. | python.library.time#time.perf_counter_ns |
time.process_time() → float
Return the value (in fractional seconds) of the sum of the system and user CPU time of the current process. It does not include time elapsed during sleep. It is process-wide by definition. The reference point of the returned value is undefined, so that only the difference between the resul... | python.library.time#time.process_time |
time.process_time_ns() → int
Similar to process_time() but return time as nanoseconds. New in version 3.7. | python.library.time#time.process_time_ns |
time.pthread_getcpuclockid(thread_id)
Return the clk_id of the thread-specific CPU-time clock for the specified thread_id. Use threading.get_ident() or the ident attribute of threading.Thread objects to get a suitable value for thread_id. Warning Passing an invalid or expired thread_id may result in undefined behavi... | python.library.time#time.pthread_getcpuclockid |
time.sleep(secs)
Suspend execution of the calling thread for the given number of seconds. The argument may be a floating point number to indicate a more precise sleep time. The actual suspension time may be less than that requested because any caught signal will terminate the sleep() following execution of that signa... | python.library.time#time.sleep |
time.strftime(format[, t])
Convert a tuple or struct_time representing a time as returned by gmtime() or localtime() to a string as specified by the format argument. If t is not provided, the current time as returned by localtime() is used. format must be a string. ValueError is raised if any field in t is outside of... | python.library.time#time.strftime |
time.strptime(string[, format])
Parse a string representing a time according to a format. The return value is a struct_time as returned by gmtime() or localtime(). The format parameter uses the same directives as those used by strftime(); it defaults to "%a %b %d %H:%M:%S %Y" which matches the formatting returned by ... | python.library.time#time.strptime |
class time.struct_time
The type of the time value sequence returned by gmtime(), localtime(), and strptime(). It is an object with a named tuple interface: values can be accessed by index and by attribute name. The following values are present:
Index Attribute Values
0 tm_year (for example, 1993)
1 tm_mon ran... | python.library.time#time.struct_time |
time.thread_time() → float
Return the value (in fractional seconds) of the sum of the system and user CPU time of the current thread. It does not include time elapsed during sleep. It is thread-specific by definition. The reference point of the returned value is undefined, so that only the difference between the resu... | python.library.time#time.thread_time |
time.thread_time_ns() → int
Similar to thread_time() but return time as nanoseconds. New in version 3.7. | python.library.time#time.thread_time_ns |
time.time() → float
Return the time in seconds since the epoch as a floating point number. The specific date of the epoch and the handling of leap seconds is platform dependent. On Windows and most Unix systems, the epoch is January 1, 1970, 00:00:00 (UTC) and leap seconds are not counted towards the time in seconds ... | python.library.time#time.time |
time.timezone
The offset of the local (non-DST) timezone, in seconds west of UTC (negative in most of Western Europe, positive in the US, zero in the UK). See note below. | python.library.time#time.timezone |
time.time_ns() → int
Similar to time() but returns time as an integer number of nanoseconds since the epoch. New in version 3.7. | python.library.time#time.time_ns |
time.tzname
A tuple of two strings: the first is the name of the local non-DST timezone, the second is the name of the local DST timezone. If no DST timezone is defined, the second string should not be used. See note below. | python.library.time#time.tzname |
time.tzset()
Reset the time conversion rules used by the library routines. The environment variable TZ specifies how this is done. It will also set the variables tzname (from the TZ environment variable), timezone (non-DST seconds West of UTC), altzone (DST seconds west of UTC) and daylight (to 0 if this timezone doe... | python.library.time#time.tzset |
timeit — Measure execution time of small code snippets Source code: Lib/timeit.py This module provides a simple way to time small bits of Python code. It has both a Command-Line Interface as well as a callable one. It avoids a number of common traps for measuring execution times. See also Tim Peters’ introduction to th... | python.library.timeit |
timeit.default_timer()
The default timer, which is always time.perf_counter(). Changed in version 3.3: time.perf_counter() is now the default timer. | python.library.timeit#timeit.default_timer |
timeit.repeat(stmt='pass', setup='pass', timer=<default timer>, repeat=5, number=1000000, globals=None)
Create a Timer instance with the given statement, setup code and timer function and run its repeat() method with the given repeat count and number executions. The optional globals argument specifies a namespace in ... | python.library.timeit#timeit.repeat |
timeit.timeit(stmt='pass', setup='pass', timer=<default timer>, number=1000000, globals=None)
Create a Timer instance with the given statement, setup code and timer function and run its timeit() method with number executions. The optional globals argument specifies a namespace in which to execute the code. Changed i... | python.library.timeit#timeit.timeit |
class timeit.Timer(stmt='pass', setup='pass', timer=<timer function>, globals=None)
Class for timing execution speed of small code snippets. The constructor takes a statement to be timed, an additional statement used for setup, and a timer function. Both statements default to 'pass'; the timer function is platform-de... | python.library.timeit#timeit.Timer |
autorange(callback=None)
Automatically determine how many times to call timeit(). This is a convenience function that calls timeit() repeatedly so that the total time >= 0.2 second, returning the eventual (number of loops, time taken for that number of loops). It calls timeit() with increasing numbers from the sequen... | python.library.timeit#timeit.Timer.autorange |
print_exc(file=None)
Helper to print a traceback from the timed code. Typical use: t = Timer(...) # outside the try/except
try:
t.timeit(...) # or t.repeat(...)
except Exception:
t.print_exc()
The advantage over the standard traceback is that source lines in the compiled template will be displayed. ... | python.library.timeit#timeit.Timer.print_exc |
repeat(repeat=5, number=1000000)
Call timeit() a few times. This is a convenience function that calls the timeit() repeatedly, returning a list of results. The first argument specifies how many times to call timeit(). The second argument specifies the number argument for timeit(). Note It’s tempting to calculate mea... | python.library.timeit#timeit.Timer.repeat |
timeit(number=1000000)
Time number executions of the main statement. This executes the setup statement once, and then returns the time it takes to execute the main statement a number of times, measured in seconds as a float. The argument is the number of times through the loop, defaulting to one million. The main sta... | python.library.timeit#timeit.Timer.timeit |
exception TimeoutError
Raised when a system function timed out at the system level. Corresponds to errno ETIMEDOUT. | python.library.exceptions#TimeoutError |
tkinter — Python interface to Tcl/Tk Source code: Lib/tkinter/__init__.py The tkinter package (“Tk interface”) is the standard Python interface to the Tk GUI toolkit. Both Tk and tkinter are available on most Unix platforms, as well as on Windows systems. (Tk itself is not part of Python; it is maintained at ActiveStat... | python.library.tkinter |
tkinter.colorchooser — Color choosing dialog Source code: Lib/tkinter/colorchooser.py The tkinter.colorchooser module provides the Chooser class as an interface to the native color picker dialog. Chooser implements a modal color choosing dialog window. The Chooser class inherits from the Dialog class.
class tkinter.c... | python.library.tkinter.colorchooser |
tkinter.colorchooser.askcolor(color=None, **options)
Create a color choosing dialog. A call to this method will show the window, wait for the user to make a selection, and return the selected color (or None) to the caller. | python.library.tkinter.colorchooser#tkinter.colorchooser.askcolor |
class tkinter.colorchooser.Chooser(master=None, **options) | python.library.tkinter.colorchooser#tkinter.colorchooser.Chooser |
class tkinter.commondialog.Dialog(master=None, **options)
show(color=None, **options)
Render the Dialog window. | python.library.dialog#tkinter.commondialog.Dialog |
show(color=None, **options)
Render the Dialog window. | python.library.dialog#tkinter.commondialog.Dialog.show |
tkinter.dnd — Drag and drop support Source code: Lib/tkinter/dnd.py Note This is experimental and due to be deprecated when it is replaced with the Tk DND. The tkinter.dnd module provides drag-and-drop support for objects within a single application, within the same window or between windows. To enable an object to b... | python.library.tkinter.dnd |
class tkinter.dnd.DndHandler(source, event)
The DndHandler class handles drag-and-drop events tracking Motion and ButtonRelease events on the root of the event widget.
cancel(event=None)
Cancel the drag-and-drop process.
finish(event, commit=0)
Execute end of drag-and-drop functions.
on_motion(event)
... | python.library.tkinter.dnd#tkinter.dnd.DndHandler |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.