Difference between revisions of "Python"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "Truxton supports Python 3.8 via the <code>Truxton.pyd</code> library. You must use the "import" directive to load this. Got to the <code>C:\Program Files\Truxton\SDK</code> f...")
 
Line 8: Line 8:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
When you import <code>truxton</code> you will get all of the predefined constants for [[File Types Supported | file type,]] [[DATA TYPE | data type,]] [[Location Types | locations,]]
+
When you import <code>truxton</code> you will get all of the predefined constants for [[File Types Supported | file type,]] [[DATA TYPE | data type,]] [[Origin | origins,]] [[Location Types | locations,]]
 
[[Message Types | messages,]] [[Entity Types | entities,]] [[Relation Types | relations,]] [[Event Types | events,]] [[Media Types | media,]] [[Object Types | objects,]] [[URL Methods | url methods,]] and [[URL Types | urls.]]
 
[[Message Types | messages,]] [[Entity Types | entities,]] [[Relation Types | relations,]] [[Event Types | events,]] [[Media Types | media,]] [[Object Types | objects,]] [[URL Methods | url methods,]] and [[URL Types | urls.]]
 
You can see them all by issuing a <code>dir</code> command.
 
You can see them all by issuing a <code>dir</code> command.

Revision as of 11:01, 21 May 2020

Truxton supports Python 3.8 via the Truxton.pyd library.

You must use the "import" directive to load this. Got to the C:\Program Files\Truxton\SDK folder and start Python.

import truxton

When you import truxton you will get all of the predefined constants for file type, data type, origins, locations, messages, entities, relations, events, media, objects, url methods, and urls. You can see them all by issuing a dir command.

>>> dir(truxton)

This will allow your Python code to use the same constant names as C, C++ and C# code.

>>> print(truxton.Type_JPEG)
203
>>> print(truxton.DATA_TYPE_BIG_ENDIAN_uint64_t)
39
>>> print(truxton.LOCATION_TYPE_EXIF)
9
>>> print(truxton.MESSAGE_TYPE_MIME)
1
>>> print(truxton.ENTITY_TYPE_MAC_ADDRESS)
4
>>> print(truxton.RELATION_PASSWORD)
11
>>> print(truxton.EVENT_TYPE_FACEBOOK_LOGON)
21
>>> print(truxton.MEDIA_TYPE_HARD_DISK_IMAGE)
3
>>> print(truxton.OBJECT_TYPE_ENTITY)
7
>>> print(truxton.URL_METHOD_TYPE_GET)
7
>>> print(truxton.URL_TYPE_OPERA)
10

Once you have this working, you can start playing with Truxton.

import truxton

def main():
  t = truxton.create()
  print(t.version())

if __name__ == "__main__":
  main()

Classes

Truxton exposes several classes to Python.