import PySimpleGUI as sg
import pyvisa as visa
IP_address = '192.168.1.3'
rm = visa.ResourceManager()
ds1054z = rm.open_resource('TCPIP::' + IP_address + '::INSTR')
layout = [
[sg.Text('SCPI command:'), sg.Input('*IDN?', key='-SCPI-'), sg.Button('Send')],
[sg.Text('Response:'), sg.Input('SCPI answer', key='-ANSWER-', expand_x=True, readonly=True)],
[sg.Button('Exit')]
]
window = sg.Window('Simple SCPI Sender', layout, finalize=True)
window['-SCPI-'].bind('<Return>', '_Enter')
window['-SCPI-'].bind('<KP_Return>', '_Enter')
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
break
if event == 'Exit':
break
if event == 'Send' or event == '-SCPI-' + '_Enter':
if values['-SCPI-'][-1] == '?':
answer = ds1054z.query(values['-SCPI-'])
else:
answer = ds1054z.write(values['-SCPI-'])
window['-ANSWER-'].update(answer)
ds1054z.close()
rm.close()
window.close()
Dependencies:
# Tested with a live DVD .iso boot of Kubuntu 20.04 LTS
sudo apt update
sudo apt install python3-pip idle
pip install pysimplegui pyvisa-py
I'm having a lot of trouble learning SCPI. I'm having trouble figuring out how to use pyvisa to communicate with devices via SCPI. But I don’t give up, I always liked what I do. At the same time, I started reading about ai in crm benefits, and found here more information for myself. I know for sure that I won’t stop. Those who do not go to the end achieve nothing.