Jump to content
  • 0

Python keyword args for DWF methods


jamesbraza

Question

Hello Digilent Forums,

I am trying to write a Python script for the impedance analyzer.  I am reading the WaveForms SDK and following examples.

I noticed all methods in the examples that use the dwf (Ex: `dwf.FDwfDeviceOpen`) use positional arguments.

In the SDK, it lists the parameter names/types for the method (Ex: `FDwfDeviceOpen(int idxDevice, HDWF *phdwf)`).

I have tried and failed to figure out how to specify them using keyword arguments instead.  Is it possible?

Thank you in advance for your help!

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Hi @attila,

Thank you for getting back to me.  I ended up writing 1:1 wrapper functions on the API methods I use that look something like this.

def FDwfDeviceClose(hdwf: c_int) -> int:
    """Close the handle for a given device.

    Args:
        hdwf: (c_int) dwf handle

    Returns:
        int: 1 if successful, 0 if unsuccessful

    """
    return dwf.FDwfDeviceClose(hdwf)

Note: `dwf` is a global variable in this case.

Cheers to AD2!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...