From 329e7189ccb5e0abe9bfef59dbb94305268bbddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Bourdeauducq?= Date: Mon, 25 Mar 2024 14:55:17 +0800 Subject: [PATCH] example: add interactive args --- .../no_hardware/repository/interactive.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 artiq/examples/no_hardware/repository/interactive.py diff --git a/artiq/examples/no_hardware/repository/interactive.py b/artiq/examples/no_hardware/repository/interactive.py new file mode 100644 index 000000000..5effb1583 --- /dev/null +++ b/artiq/examples/no_hardware/repository/interactive.py @@ -0,0 +1,20 @@ +from artiq.experiment import * + + +class InteractiveDemo(EnvExperiment): + def build(self): + pass + + def run(self): + print("Waiting for user input...") + with self.interactive() as interactive: + interactive.setattr_argument("number", NumberValue(42e-6, + unit="us", + precision=4)) + interactive.setattr_argument("integer", NumberValue(42, + step=1, precision=0)) + interactive.setattr_argument("string", StringValue("Hello World")) + print("Done! Values:") + print(interactive.number, type(interactive.number)) + print(interactive.integer, type(interactive.integer)) + print(interactive.string)