Use lys as Python interpreter

Use Python interpreter

  1. After starting lys, you see the main window.

../_images/overview.png
  1. Click “Show” button at the bottom-right edge to show the command log.

../_images/ShowButton.png
  1. Type the command below in the text box at the bottom:

    print("Hello, lys")
    
../_images/command.png
  1. You see the “print” command is executed as Python command.

../_images/commandResult.png
  1. It’s done! You can execute all Python commands from the Python interpreter in lys.

Define new function

  1. Next, let’s try to define new function and execute. Press Ctrl+P to open proc.py file.

../_images/Proc.png
  1. Define function below and Press Ctrl+S to save the contents:

    def add(value):
        return value + 1
    

It is saved as “./module/proc.py”.

../_images/Function1.png
  1. Type the code below to execute “add” function from the command line (You see “Result: 4”):

    print("Result:", add(3))
    
../_images/AddFunc.png
  1. It’s done! You can define arbitrary function and class in proc.py file. If you want to understand what is done for detail, see Understanding shell in lys

Now you can do everything that Python can do in lys. Go to next step(Display graphs in lys)