Skip to content

5Stygian/CMUG_Python_Projects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMUG Install Instructions

Only tested on VSCode *

  • Install the CMU Graphics library from their website: CMU Graphics Download.
  • Move the folder titled cmu_graphcis into the directory with your python file that imports it.
    • Don't forget to add it to your .gitignore!
  • Add from cmu_graphics import * to the top of the python file.
  • At the bottom of your file, add a function called runApp() with the keyword arguments width and height. These will define the width and height of your window.
  • All of your code that will be drawn must be inside of a function called redrawAll(). It takes a single argument, app.

Notes:

  • All shape functions (Rect, Polygon, etc.) are replaced with drawRect, drawPolygon, etc.
  • If your project throws an error that ends with a message about a module named 'pygame', initialize and activiate a .venv and run pip install pygame in the command line.

This is an example of what your file should look like:

from cmu_graphics import *

def redrawAll(app):
    exampleShape: Rect = drawRect(
        100,100,
        100,100,
        fill=gradient("white","black", start="right")
    )

    exampleLabel: Label = drawLabel(
        'Jello, World!',
        120,350,
        size=41,
        fill='cornflowerBlue',
        font='arial'
    )

app.title = "My Super Awesome Example Program"

runApp(
    width=400,
    height=400
)

This is what your file structure should look like:

| DIRECTORY_NAME  
 \| cmu_graphics  
  | main.py  

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages