Professional Documents
Culture Documents
Oscilloscope Screenshot Code
Oscilloscope Screenshot Code
# Purpose: This example demonstrates how to save a screen shot (hard copy) image
# Development Environment: Python 3.6, PyVisa 1.8, NI-VISA 2017, Windows 10 x64
# Tektronix provides the following example "AS IS" with no support or warranty.
#-------------------------------------------------------------------------------
visaRsrcAddr = "MSO58"
rm = visa.ResourceManager()
scope = rm.open_resource(visaRsrcAddr)
scope.write('SAVE:IMAGe \"C:/Temp.png\"')
# Generate a filename based on the current Date & Time
dt = datetime.now()
fileName = dt.strftime("MSO5_%Y%m%d_%H%M%S.png")
scope.query('*OPC?')
scope.write('FILESystem:READFile \"C:/Temp.png\"')
imgData = scope.read_raw(1024*1024)
file.write(imgData)
file.close()
# Image data has been transferred to PC and saved. Delete image file from
instrument's hard disk.
scope.write('FILESystem:DELEte \"C:/Temp.png\"')
scope.close()
rm.close()