Pythonwin COM Question

Sam Schulenburg samschul at pacbell.net
Mon Apr 24 23:07:28 EDT 2000


In Visual Basic I have the following:
'===============================================
Dim theFrame As Varient
Dim dx as DocFile
Dim ex as New ExpSetup
Dim bRes as Integer

if (ex.Start(dx)) then
   While ex.GetParam(EXP_RUNNING,bRes)
       DoEvents 'Wait for detector to finish
   Wend
   dx.GetFrame 1, theFrame 'Retreive one image
end if
'===============================================

In Python I have the equivalent:

from PrincetonInst import *  # Get the renamed Makepy file for the
                             # COM object

theFrame = []                # Set up the Varient
dx = DocFile()               # Get the DocFile class
ex = win32com.client.Dispatch(ExpSetup.CLSID)
bRes = 0

if (ex.Start(dx)) then       # Start detector scanning  for data
   While ex.GetParam(EXP_RUNNING,bRes):  # Detector is scanning
      ## DoEvents  # Wait for detector to finish, This has no
                   # equivalent in Pythonwin
         s = 1     # This gives the while loop something to do
   #### This is where everything falls apart
   #### theFrame is not the correct datatype
   dx.GetFrame(1,theFrame)  # Retreive one image

How do I define the correct Varient type in Python?

Sam Schulenburg


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list