![]() ![]() |
| |||||||||
| Hotspots: Slides and Code TA Corner Comments? Announcements FAQ Static Webspace | ||||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| There should be. You only need the T-square part to submit though, all the instructions are on the Coweb. Thanks! Brittany Duncan |
| That is fine. Thanks! Brittany Duncan |
| First, make sure that your function is "flag()". Capitalization counts. Second, try to be a bit more creative with your functions. For instance, instead of makeWhite, why not use negative() on a dark picture? Finally, you can have input parameters in helper functions, just not in the flag() function. Let me know if you have anymore questions or need more direction. Thanks! Brittany Duncan |
| Sure. Thanks! Brittany Duncan |
| It was unintentional I assure you. I chose random flags and figured people would ask for any others that they wanted. Thanks! Brittany Duncan |
| I believe that is the same as the French flag, so yes. ;-) (Please read other people's questions before posting your own.) Thanks! Brittany Duncan |
| I'm hesitant to approve that because I don't know how you would put the image in the center. E-mail me if you want to discuss this further. Thanks! Brittany Duncan |
| Sure. ANY flag that is geometrically similar to the ones that we have posted (tricolor, Scandinavian crosses, etc.) are fine. If only the colors are different, you don't need to ask about those. And if you want to use a flag that has an emblem in it, you can just leave that out. If you do that, the Mexican and Italian flags are the same. Colin Potts |
| That should be fine. Thanks! Brittany Duncan |
| Already answered above. Colin Potts |
| Please read the statement above by Brittany. 'ANY flag that is geometrically similar to the ones posted...is fine'. Chris Phillips |
| Nothing works after the return command. Colin Potts |
| We would like you to be a little more creative than simply increasing or decreasing colors for all the pictures. Thanks! Brittany Duncan |
| I detailed that in the instructions. You could use a separate copy function for example. Thanks! Brittany Duncan |
| If you have figured out how to do it, it will be neat. Thanks! Brittany Duncan |
| If you want to use a larger underlying picture as your canvas, that is fine. Colin Potts |
| Either is fine, so long as they conform to the grading criteria, and don't do the same thing. Chris Phillips |
| The thing that you return using the return command has to be the picture representing the flag, and JES only knows what this is if you give it the correct name. I am guessing that you said something like picture=makeEmptyPicture(....) earlier in your code, but did not use the name "picture". Colin Potts |
| If you put print/show/repaint statements in your code to debug your program as you go along (a really good idea, by the way), you should take them out before submitting. Think of them like scaffolding that builders take down once a building is complete. Colin Potts |
| Sure! I would not try to include the symbol (dove? and what is it sitting on?). Colin Potts |
| I'd be wary of picking that one, however. Note how the edge of the striping is diagonal. How are you going to copy things over in a diagonal fashion like that? It can be done...but it might be more then you want to do for the assignment. Chris Phillips |
| No. Colin Potts |
| Sorry. I may have misunderstood your question. You can't use pickAFile inside your function to read the pictures – which is not what you were asking – but you CAN use it in the command area (which, of course, is not part of your turn-in) to help write the pictures out. However, BE CAREFUL. If you writePictureTo(flag(), pickAFile()), you will overwrite whatever was in the file that you pick with the flag that you are writing. JES will not say "Are you sure?" but will just do it. So you need to make some copies in Windows/Mac Finder, first, to make sure that you are not overwriting a file picture that you need later. If this second answer doesn't make sense to you, you definitely should not experiment with combining writePictureTo and pickAFile. Colin Potts |
| I think you may have forgotten that flag needs to return a picture so that you can say myFlag = flag() in the command area and then writePictureTo(myFlag, ....). Colin Potts |
| The book was written before makeEmptyPicture was implemented. That is a better way to make a canvas. Either way, it should be in the flag function itself, because flag is not allowed to have any arguments. Colin Potts |
| See previous answer. Colin Potts |
| Why ever not? We have said yes twice already. Colin Potts |
| First, make sure that the flag function returns the flag and doesn't just show it. Then, you can say something like myFlag=flag() in the command area. If you already have set the media path (and I posted instructions on this to the code/slides page) you can then just type writePictureTo(myFlag, getMediaPath("flag.jpg")) and your flag image will be written to the file flag.jpg in your media path folder. Colin Potts |
| (1) If you want to scale your image, the easiest thing to do is to prep your pictures in advance using an imaging tool like Photoshop, which is available on many lab/library computers. There is also a free ScaleTool on the downloads page. It's a bit flakey, but works. (2) If you just want to crop a big image (as opposed to scale it), you could again use a commercial imaging program or simply copy the part of the image that you want in your flag function. For example, instead of copying all of the pixels from your picture onto the flag, you just copy a vertical slice of them. Colin Potts |
| If you're using Windows, I'd recommend using Irfanview. It's a free photo editing tool, with a lot of interesting features (many of them even useful), and it's also fairly intuitive. I use it all the time. Chris Phillips |
| This is a configuration problem that some PC users have. We haven't been able to fix it properly, but there is a work-around. Write the file to the very top-level folder, like this: writePictureTo(picture, "C:\flag.jpg"). You will then have to move it where you really want it to be. Colin Potts |
| You might also need that little 'r' in there, and two slashes (in case your image name starts with a character that can be escaped). So writePictureTo(picture, r"C:\\flag.jpg"). I have yet to see that fail on a Windows computer. Chris Phillips |
| It always tells me that, but when I look, it has created a file. So check and make sure there really isn't a file there. Thanks! Brittany Duncan |
| Please read all questions and responses before posting a question. Thanks! Brittany Duncan |
| The first thing you should do is stop making random changes to your program. It should always do the same thing. Wrong is better than random. I'm guessing that what you didn't do the first time was load your program, and what you then did was take a return command out of flag(). Put it back and we'll solve the problem from there. Colin Potts |
| And what error are you getting when you have these two lines in your flag function? (They are actually IN your flag function, aren't they? The return command should be at the end of flag, not necessarily the last line of code in your program.....) Colin Potts |
| You're making your canvas with a height of 450, but you are trying to write to a pixel on row 451 - presumably because one of the Photoshopped images that you are attempting to copy is too tall. Colin Potts |
| Oh, wait. you're doing the Russian flag, aren't you? So your pictures are probably each 150 tall. If so, the problem is probably with the y offset that you are adding to the destination y values in the second and third pictures. The sum should never go to more than 300 (so there is room for the third picture of 150 pixels height, making a total of 450), but somehow you are adding too much of a y offset. You might be able to get this to work by using a ridiculously high canvas. Start at 600, instead of 450, and work upward until it "works". Then show the resulting flag and work out by how much your offset needs to be reduced. Colin Potts |
| What happens when you show(myFlag) Colin Potts |
| It looks like you have a Windows weirdness and are not doing anything wrong. It would be nice to get this sorted before the movie homework, because there you will need to write multiple files. For now, just submit your code and starting images and email your TA that there is a problem with writePictureTo that we can't fix right now, and you'll get as much credit as if you had uploaded your flag. Colin Potts |
| That's not an error. You're returning the canvas/flag, but you're then throwing it away and not using it. Instead of flag(), type show(flag()) or coolFlag = flag() in the command area. Then you can show coolFlag later, save it to file.... Whatever Colin Potts |
| That is fine, but you will need to know how to write a copy function for your next exam. Thanks! Brittany Duncan |
| There is no lock password on the gallery. Thanks! Brittany Duncan |