Difference between revisions of "WIN Python IDE"

From SecuTech Wiki
Jump to: navigation, search
m
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
'''How to Load UniKey.dll in Python'''
+
[[category:UniKey Library Integration Guides]]
==1) Download Python 3.1.2( you can download the lastest version )==
+
 
==2) Install Python (run setup)==
+
==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)
<br>
+
 
[[File:WIN Python IDE Pic 2.jpg|center]]
+
==Install Python (run setup)==
<br>
+
[[File:WIN Python IDE Pic 1.jpg|center|alt=Python setup window]]
[[File:WIN Python IDE Pic 3.jpg|center]]
+
 
<br>
+
 
[[File:WIN Python IDE Pic 4.jpg|center]]
+
[[File:WIN Python IDE Pic 2.jpg|center|alt=Python installation directory]]
<br>
+
 
[[File:WIN Python IDE Pic 5.jpg|center]]
+
 
<br>
+
[[File:WIN Python IDE Pic 3.jpg|center|alt=Python what features to install]]
==3)Set the environment path==
+
 
[[File:WIN Python IDE Pic 6.jpg|center]]
+
 
<br>
+
[[File:WIN Python IDE Pic 4.jpg|center|alt=Python installing Python]]
[[File:WIN Python IDE Pic 7.jpg|center]]
+
 
<br>
+
 
[[File:WIN Python IDE Pic 8.jpg|center]]
+
[[File:WIN Python IDE Pic 5.jpg|center|alt=Python install complete]]
<br>
+
 
[[File:WIN Python IDE Pic 9.jpg|center]]
+
==Set the Environment Path==
<br>
+
[[File:WIN Python IDE Pic 6.jpg|center|alt=My Computer - Properties]]
[[File:WIN Python IDE Pic 10.jpg|750px|center]]
+
 
<br>
+
 
==4)Copy the UniKey.dll file into the working directory==
+
[[File:WIN Python IDE Pic 7.jpg|center|alt=system properties]]
[[File:WIN Python IDE Pic 11.jpg|px750|center]]
+
 
<br>
+
 
==5)Write code in python IDLE==
+
[[File:WIN Python IDE Pic 8.jpg|center|alt=environment variables]]
[[File:WIN Python IDE Pic 12.jpg|750px|center]]
+
 
<br>
+
 
[[File:WIN Python IDE Pic 13.jpg|750px|center]]
+
[[File:WIN Python IDE Pic 9.jpg|center|alt=new user variable]]
<br>
+
 
 +
 
 +
[[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
+
0
The return 0 indicates that a UniKey dongle is successfully found.
+
</source>
[[File:WIN Python IDE Pic 14.jpg|750px|center]]
+
The return 0 indicates that a UniKey dongle has been successfully found.
  
[[Category:UniKey Library Integration Guides]]
+
[[File:WIN Python IDE Pic 14.jpg|750px|center|alt=Python shell running code]]
[[Category:UniKey WIN Python IDE]]
 

Latest revision as of 05: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)

Python setup window


Python installation directory


Python what features to install


Python installing Python


Python install complete

Set the Environment Path

My Computer - Properties


system properties


environment variables


new user variable


running python on the command-line

Copy the UniKey.dll File into the Working Directory

Python working directory

Write Code in Python IDLE

opening Python IDLE


Python shell


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.

Python shell running code