在Python中使用Twain模块

2024-06-16 18:59:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我有64位Windows和64位Python。在twain docs中说:只支持32位。我已使用twain data source安装我的64位计算机,并使用以下代码连接扫描仪设备:

import twain
sm = twain.SourceManager(0)
ss = sm.OpenSource()
ss.RequestAcquire(0,0) 
rv = ss.XferImageNatively()
if rv:
   (handle, count) = rv
twain.DIBToBMFile(handle, 'image.bmp')

当我运行应用程序时。窗口打开方式如下: enter image description here

为什么这个窗户是空的。扫描仪设备将显示在此窗口中?在


Tags: 代码importdocssourcedatawindows计算机ss