使用ctypes和jython

使用ctypes和jython,第1张

概述我在python脚本中使用ctypes lib时遇到了麻烦.这是我的代码(在互联网上找到):if __name__ == '__main__': from ctypes import * user32 = windll.user32 kernel32 = windll.kernel32 class RECT(Structur

我在python脚本中使用ctypes lib时遇到了麻烦.这是我的代码(在互联网上找到):

if __name__ == "__main__":    from ctypes import *    user32 = windll.user32    kernel32 = windll.kernel32    class RECT(Structure):        _fIElds_ = [            ("left",c_ulong),("top",("right",("bottom",c_ulong)];    class GUITHREADINFO(Structure):        _fIElds_ = [        ("cbSize",("flags",("hwndActive",("hwndFocus",("hwndCapture",("hwndMenuOwner",("hwndMoveSize",("hwndCaret",("rcCaret",RECT)        ]    def moveCursorInCurrentwindow(x,y):        # Find the focussed window.        guiThreadInfo = GUITHREADINFO(cbSize=sizeof(GUITHREADINFO))        user32.GetGUIThreadInfo(0,byref(guiThreadInfo))        focusseDWindow = guiThreadInfo.hwndFocus        # Find the screen position of the window.        windowRect = RECT()        user32.GetwindowRect(focusseDWindow,byref(windowRect))        # Finally,move the cursor relative to the window.        user32.SetCursorPos(windowRect.left + x,windowRect.top + y)    if __name__ == '__main__':    # Quick test.        moveCursorInCurrentwindow(100,100)

第一个问题是python无法找到ctypes,因此我将从项目站点下载的文件复制到

netbeans.9\jython-2.5.1\lib\

(是的,即时通讯使用netbeans)然后它显示此错误:

>    from ctypes import *>  file "C:\Users\k\.netbeans.9\jython-2.5.1\lib\ctypes\__init__.py",line 10,in 

就像init文件有一些错误o_O帮助人!
问候,克里斯最佳答案Jython尚未完全支持ctypes:http://bugs.jython.org/issue1328

你不能简单地为cpython编译ctypes库,并将其插入Jython.

总结

以上是内存溢出为你收集整理的使用ctypes和jython全部内容,希望文章能够帮你解决使用ctypes和jython所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1206240.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-04
下一篇 2022-06-04

发表评论

登录后才能评论

评论列表(0条)