1. Lab computer setup

Change Windows settings to better defaults.

1.1. Pin File Explorer to the Taskbar

  • Start menu → Search for “File Explorer

  • Right-click → “Pin to taskbar

win10 file pin

1.2. Change File Explorer view options

  • Open File Explorer

  • Menu: View → Options

  • Folder Options popup: select View tab

    • Select “Show hidden files, folders, and drives

    • Un-check “Hide extensions for known file types

    • Click Apply

    • Click Apply to Folders (and say Yes)

win10 file view

1.3. Install Thonny

  • Go to: This PC → Shared Drive (S:) → COE →
    COEguest Shared → Robotics → software

  • Right-click on thonny-4.n.n.exe → select “Run as administrator

  • (have instructor enter password and begin setup)

thonny install

1.4. Add black code formatter plugin

  • Open Thonny

  • Select: Tools → Manage plug-ins…​

  • search for black, and install it

thonny plugins menu
thonny plugin black
  • search for thonny-black-formatter (with the “er” at the end!), and install it

thonny plugin black formatter
  • Close dialog box and close Thonny

1.5. Change Thonny’s settings

  • Menu: View → check all of:

    • Files

    • Shell

thonny view

Check that the formatter works.

  • Copy and paste the below code into the window

  • Save it to your “Documents” folder as name first.py

text = "some string of text"

variable=42


def    do_a_thing(n, side=-1):
    """Help text for the function"""
    print (n)
    if side==0:
     print("yes")
    elif side==1:
        print("no")
    else:
        print("default")
thonny code first
  • Menu: Tools → Format with Black

    • (or use the keyboard shortcut!)

Should change the code to look like:

thonny code first reformat