Python binding for ToxCore.
- Debian, Ubuntu
- Fedora, openSUSE, CentOS
- Arch, Arch AUR (see also AUR Helpers)
$ python setup.py build
$ python setup.py install
To compile with TokTok toxcore implementation:
$ CFLAGS="-DTOX_TOKTOK" python setup.py build
See Echo Bot Example.
Most methods of ToxCore, ToxAV and ToxDNS classes well documented in original tox.h, toxav.h and toxdns.h.
Also you can get help from extension itself:
$ python
>>> from pytoxcore import ToxCore, ToxAV, ToxDNS
>>> help(ToxCore)
Additional non libtoxcore api methods and callbacks described below.
Return new (public_key, secret_key)
tuple. Used to create new tox account.
tox_keypair_new()
Return public key restored from secret key.
tox_public_key_restore(secret_key)
Return new random nospam value as hex-string.
tox_nospam_new()
Return ToxID from public key and nospam value.
tox_address_new(public_key, nospam)
Check given ToxID and throws exception if address is invalid.
tox_address_check(address)
Send file identified by path
to a friend like system sendfile
. Return file_number
on success like original tox_file_send
. Call tox_sendfile_cb
callback (see below).
tox_sendfile(friend_number, kind, path, filename, timeout)
This event is triggered when tox_sendfile
call finished.
tox_sendfile_cb(friend_number, file_number, path, filename, status)
status
may be one of:
TOX_SENDFILE_COMPLETED
- call finished successfully;TOX_SENDFILE_TIMEOUT
- send timeout occured;TOX_SENDFILE_ERROR
- filesystem, toxcore or other error.
Receive file from a friend and store it to path
. Call tox_recvfile_cb
callback (see below).
tox_recvfile(friend_number, file_number, file_size, path, filename, timeout)
This event is triggered when tox_recvfile
call finished.
tox_recvfile_cb(friend_number, file_number, path, filename, status)
status
may be one of:
TOX_RECVFILE_COMPLETED
- call finished successfully;TOX_RECVFILE_TIMEOUT
- receive timeout occured;TOX_RECVFILE_ERROR
- filesystem, toxcore or other error.
Set video frame format for toxav_video_receive_frame_cb
callback (see below).
toxav_video_frame_format_set(format)
Format may be one of:
TOXAV_VIDEO_FRAME_FORMAT_BGR
- BGR frame format;TOXAV_VIDEO_FRAME_FORMAT_RGB
- RGB frame format;TOXAV_VIDEO_FRAME_FORMAT_YUV420
- (default) YUV420 format.
Original toxav_video_send_frame
method splitted into three to send frame in BGR, RGB and YUV420 (default) formats.
toxav_video_send_bgr_frame(friend_number, width, height, bgr)
toxav_video_send_rgb_frame(friend_number, width, height, rgb)
toxav_video_send_yuv420_frame(friend_number, width, height, y, u, v)
This event is triggered when a video frame received. First for RGB/BGR video frame format, second for YUV420 (default).
toxav_video_receive_frame_cb(friend_number, width, height, rgb)
toxav_video_receive_frame_cb(friend_number, width, height, y, u, v, ystride, ustride, vstride)