Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


0 votes
asked ago in CSC201 by (208 points)

2 Answers

0 votes

If you are referring to the art_maker.py program, it produces no output. In other words, it has no print statements and so prints nothing in the console window (ie. Thonny's Shell).

You should be creating a file with the size of the image on the first line of the file. Every subsequent line of the file has 6 numbers. To get the information to the file, you need to open a file for writing and then use the write function to write the information to the file.

Even though this program does not open a file for reading, it can still open a file for writing and then write to a file like you did in Lab 3 traffic_tickets.py to create the fines.txt file.

The creating of the Pointillism picture of the image is the art_viewer program.

answered ago by (4.2k points)
0 votes

If you meant, where do the numbers come from that you write to the file, the number on the first line comes from the size of the image. There is a method for Image objects that will allow you to retrieve it. Our image is guaranteed to be square.

For the remaining lines of the file...
The first two numbers are randomly generated to be valid x and y coordinates for points in the image.
The third number is randomly generated to be a valid size radius. See the directions for the possible valid sizes.
The fourth, fifth, and sixth numbers come from using the getPixel method on the Image object. See Zelle p. 120 .

answered ago by (4.2k points)