WIN Python IDE: Difference between revisions
From SecuTech Wiki
Jump to navigationJump to search
mNo edit summary |
|||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
[[category:UniKey Library Integration Guides]] | |||
== | |||
== | ==How to Load UniKey.dll in Python== | ||
[[File:WIN Python IDE Pic 1.jpg|center]] | Download Python 3.1.2 (you can download the latest version) | ||
[[File:WIN Python IDE Pic 2.jpg|center]] | ==Install Python (run setup)== | ||
[[File:WIN Python IDE Pic 1.jpg|center|alt=Python setup window]] | |||
[[File:WIN Python IDE Pic 3.jpg|center]] | |||
[[File:WIN Python IDE Pic 4.jpg|center]] | [[File:WIN Python IDE Pic 2.jpg|center|alt=Python installation directory]] | ||
[[File:WIN Python IDE Pic 5.jpg|center]] | |||
[[File:WIN Python IDE Pic 3.jpg|center|alt=Python what features to install]] | |||
== | |||
[[File:WIN Python IDE Pic 6.jpg|center]] | |||
[[File:WIN Python IDE Pic 4.jpg|center|alt=Python installing Python]] | |||
[[File:WIN Python IDE Pic 7.jpg|center]] | |||
[[File:WIN Python IDE Pic 8.jpg|center]] | [[File:WIN Python IDE Pic 5.jpg|center|alt=Python install complete]] | ||
[[File:WIN Python IDE Pic 9.jpg|center]] | ==Set the Environment Path== | ||
[[File:WIN Python IDE Pic 6.jpg|center|alt=My Computer - Properties]] | |||
[[File:WIN Python IDE Pic 10.jpg|750px|center]] | |||
== | [[File:WIN Python IDE Pic 7.jpg|center|alt=system properties]] | ||
[[File:WIN Python IDE Pic 11.jpg|px750|center]] | |||
== | [[File:WIN Python IDE Pic 8.jpg|center|alt=environment variables]] | ||
[[File:WIN Python IDE Pic 12.jpg|750px|center]] | |||
[[File:WIN Python IDE Pic 13.jpg|750px|center]] | [[File:WIN Python IDE Pic 9.jpg|center|alt=new user variable]] | ||
[[File:WIN Python IDE Pic 10.jpg|750px|center|alt=running python on the command-line]] | |||
==Copy the UniKey.dll File into the Working Directory== | |||
[[File:WIN Python IDE Pic 11.jpg|px750|center|alt=Python working directory]] | |||
==Write Code in Python IDLE== | |||
[[File:WIN Python IDE Pic 12.jpg|750px|center|alt=opening Python IDLE]] | |||
[[File:WIN Python IDE Pic 13.jpg|750px|center|alt=Python shell]] | |||
Please write the following code in Python Shell. | Please write the following code in Python Shell. | ||
<source lang="python" collapse="true" first-line="2" highlight="[4,6]" title="title"> | |||
>>> import ctypes as C | >>> import ctypes as C | ||
>>> h=C.c_short() | >>> h=C.c_short() | ||
| Line 37: | Line 51: | ||
>>> lp2 = C.c_ulong() | >>> lp2 = C.c_ulong() | ||
>>> dll = C.windll.LoadLibrary('UniKey.dll') | >>> dll = C.windll.LoadLibrary('UniKey.dll') | ||
>> dll.UniKey_Find(C.byref (h) , C.byref (lp1) , C.byref(lp2)) | >>> dll.UniKey_Find(C.byref (h) , C.byref (lp1) , C.byref(lp2)) | ||
> | 0 | ||
The return 0 indicates that a UniKey dongle | </source> | ||
The return 0 indicates that a UniKey dongle has been successfully found. | |||
[[ | [[File:WIN Python IDE Pic 14.jpg|750px|center|alt=Python shell running code]] | ||
Latest revision as of 15:53, 9 August 2016
How to Load UniKey.dll in Python
Download Python 3.1.2 (you can download the latest version)
Install Python (run setup)





Set the Environment Path





Copy the UniKey.dll File into the Working Directory

Write Code in Python IDLE


Please write the following code in Python Shell.
>>> import ctypes as C
>>> h=C.c_short()
>>> lp1 = C.c_ulong()
>>> lp2 = C.c_ulong()
>>> dll = C.windll.LoadLibrary('UniKey.dll')
>>> dll.UniKey_Find(C.byref (h) , C.byref (lp1) , C.byref(lp2))
0
The return 0 indicates that a UniKey dongle has been successfully found.
