In this example, I call my main program main.py and I call my module draw.py.
craig@ubuntu-desktop:~/Development/dad/screens$ lsdraw.py draw.pyc main.py
Ignore the file, draw.pyc. It is created automatically when you run the program.
From main.py, you can access draw.py using import draw
My draw module just puts two graphics to the screen, one with a function and with with a class.
To access the module from the program, you can either call the function directly with draw.dot(SCREEN) or instantiate the class.
Here's the full code listing:
Image of program showing how main.py calls up the draw function from draw.py.
No comments:
Post a Comment