Py Editor MAC USER MANUALpythoneditor.io ↗ · Version 27.0.3 (33)

Your first project: write, save and run a script

In about ten minutes you will create a project, write a short program and see its output inside Py Editor. The program uses only the standard library, so there is nothing to install.

1. Create the project

  1. Choose File → Show Project Launcher.
  2. Click New Python Project.
  3. Enter Vision Dataset Notes in Save As.
  4. Check Where. The app's Projects folder is a good place to start.
  5. Click Create.

The New Python Project dialog with a project name and destinationOpen the screenshot to view it at full size.

The project opens in its own window with main.py and pyproject.toml in the Project panel on the left.

2. Write the program

  1. Click main.py in Project.

  2. Click in the editor, select everything, and type this in its place:

    """Plan a balanced image-classification dataset."""
    
    CLASS_NAMES = ("vertical", "horizontal", "diagonal")
    SAMPLES_PER_CLASS = 180
    IMAGE_SIZE = (20, 20)
    
    
    def main():
        total = len(CLASS_NAMES) * SAMPLES_PER_CLASS
        print("Vision dataset plan")
        print(f"Classes: {len(CLASS_NAMES)}")
        print(f"Images per class: {SAMPLES_PER_CLASS}")
        print(f"Total images: {total}")
        print(f"Image size: {IMAGE_SIZE[0]} x {IMAGE_SIZE[1]}")
    
    
    if __name__ == "__main__":
        main()
    
  3. Press Command-S to save. The dot on the tab disappears.

3. Run it

  1. Check that the run configuration in the toolbar says Current Selected File and that main.py is selected.
  2. Click the run button in the toolbar.
  3. Read the output in Run, at the bottom of the window.

The saved program and its output in the Run panelOpen the screenshot to view it at full size.

You should see:

Vision dataset plan
Classes: 3
Images per class: 180
Total images: 540
Image size: 20 x 20

The status bar shows the interpreter the project used, and Run reports that the process finished.

4. Come back to it later

Choose File → Show Project Launcher, type part of the project's name in the search field and press Return. The project is also listed under File → Recent Projects.

Next steps