Python API: Difference between revisions
Jump to navigation
Jump to search
(Created page with "= Overview = The python API can be used: * directly in the system console, using a general python interpret * in the Pixet program integrated python console The base is '''pypixet object'''. It has methods for initialize and deinitialize, can create the pixet object.<br> The '''pixet object''' have device list, can create device objects and allows access to global properties.<br> A '''device objects''' have methods for acquisions and allows access to device parameters.<...") |
|||
Line 25: | Line 25: | ||
print("dev.doSimpleAcquisition - end:", rc, "(0 is OK)") | print("dev.doSimpleAcquisition - end:", rc, "(0 is OK)") | ||
pixet.exitPixet() # save settings, correct stop devices and core exit | pixet.exitPixet() # save settings, correct stop devices and core exit | ||
pypixet.exit() # both lines mportant if third-party debug environment used | pypixet.exit() # both lines mportant if third-party debug environment used | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 14:59, 18 July 2023
Overview
The python API can be used:
- directly in the system console, using a general python interpret
- in the Pixet program integrated python console
The base is pypixet object. It has methods for initialize and deinitialize, can create the pixet object.
The pixet object have device list, can create device objects and allows access to global properties.
A device objects have methods for acquisions and allows access to device parameters.
The pypxproc object is intended for use to processing of a data.
The pygui object allows you to create your own graphical interface. It can be used only if a script is run from the Pixet program.
Small code example for using in the system console or other third-party environment, with the Python 3.7:
import pypixet
print("pixet core init...")
pypixet.start()
pixet=pypixet.pixet
devices = pixet.devicesByType(pixet.PX_DEVTYPE_TPX3)
dev = devices[0]
dev.setOperationMode(pixet.PX_TPX3_OPM_EVENT_ITOT)
print("dev.doSimpleAcquisition (3 frames @ 1 sec) - start")
rc = dev.doSimpleAcquisition(3, 1, pixet.PX_FTYPE_AUTODETECT, "example.png")
print("dev.doSimpleAcquisition - end:", rc, "(0 is OK)")
pixet.exitPixet() # save settings, correct stop devices and core exit
pypixet.exit() # both lines mportant if third-party debug environment used
Small code example for using in the Pixet python console with integrated Python:
# do not create the pypixet and pixet, they exist by default
devices = pixet.devicesByType(pixet.PX_DEVTYPE_TPX3)
dev = devices[0]
dev.setOperationMode(pixet.PX_TPX3_OPM_EVENT_ITOT)
print("dev.doSimpleAcquisition (3 frames @ 1 sec) - start")
rc = dev.doSimpleAcquisition(3, 1, pixet.PX_FTYPE_AUTODETECT, "example.png")
print("dev.doSimpleAcquisition - end: %i (0 is OK)" % rc)
# do not execute the pixet.exitPixet(), it will cause whole the Pixet program to exit