TP-Related Demos


These notes are optional, but you may find these topics very useful for your term projects.
  1. Installing Desktop CMU Graphics
  2. Installing required modules (PIL/Pillow and Requests)
  3. Demos

  1. Installing Desktop CMU Graphics
    See here.

  2. Installing required modules (PIL/Pillow and Requests)
    To use these demos in CMU Graphics, you need to have some modules installed. If they are not installed, you will see a message like this (or a similar one for "requests" instead of "PIL"):
    **********************************************************
    ** Cannot import PIL -- it seems you need to install pillow
    ** This may result in limited functionality or even a runtime error.
    **********************************************************
    
    You can try to use 'pip' to install the missing modules, but it can be complicated making sure you are installing these modules for the same version of Python that you are running. Here are some more-reliable steps that should work for you:

    • For Windows:
      1. Run this Python code block in your main Python file (it will print the commands you need to paste into your command prompt):
        import sys
        print(f'"{sys.executable}" -m pip install pillow')
        print(f'"{sys.executable}" -m pip install requests')
        
      2. Open Command Prompt as an administrator user (right click - run as administrator)
      3. Copy-paste each of the two commands printed in step 1 into the command prompt you opened in step 2.
      4. Close the command prompt and close Python.
      5. Re-open Python, and you're set (hopefully)!

    • For Mac or Linux:
      1. Run this Python code block in your main Python file (it will print the commands you need to paste into your command prompt):
        import sys
        print(f'sudo "{sys.executable}" -m pip install pillow')
        print(f'sudo "{sys.executable}" -m pip install requests')
        
      2. Open Terminal
      3. Copy-paste each of the two commands printed in step 1 into the command prompt you opened in step 2.
        • If you see a lock and a password is requested, type in the same password that you use to log into your computer.
      4. Close the terminal and close Python.
      5. Re-open Python, and you're set (hopefully)!

    If these steps do not work for you, please go to OH and we will be happy to assist.

  3. Demos