Apparently, my last post was interpreted by some as "please do this assignment for me". By no means do I want this. What I would like, is for someone to look at my attached files and see if there is anything glaring they can see where I am going wrong. The error message that I get when I input values into the first page and click "Go" reads as follows:
 
Script Error

There was an error with your script and it didn't exit properly.

This was its output:

  File "/home/jgates/public_html/Fifthone.py", line 12
    print form int(["red1"].value),"%"
                 ^
SyntaxError: invalid syntax
The instructions I listed below were put there so that you could understand what exactly I was trying to do with these pages.
Any help you could provide would be much appreciated.
If you think I am out of line in asking the above, just ignore this post and I will get the drift.
But any help would be a godsend!!!
Thanks!
 
Regards,
 
Jennine
-----Original Message-----
From: gordnjen [mailto:[EMAIL PROTECTED]
Sent: July 18, 2005 4:23 PM
To: 'tutor@python.org'
Subject: Forms

HELP!

This is my latest assignment:

For this assignment, you will create a web script that lets the user explore RGB colours.

On the first page the user sees, they should specify two RGB colours.  When they submit this page, they should be presented with a range of colours in between the two.
The intermediate colours will be calculated by your program.

For example, if the user enters the colours red (100% red, 0% green, 0% blue) and white (100% red, 100% green, 100% blue), your program might output a page containing this:

Your program must never output more than 150 total colours, no matter how many the user asks for.  If the users asks for more, it should only output 150.

         

    

You have to be careful about the spacing when outputting the RGB percentage values.  You will have to convert the numbers to strings and concatenate them.  For example, this statement will output part of the style attribute:    

        print 'style="background-color: rgb(' + str(r) + '%'
           

     All of your XHTML (including generated XHTML) and CSS must be valid.
       

 


 1. Create the query page that asks the user for the colours they want to view.

   2. Create a web script that converts the values the user entered to integers, stores them in variables, and outputs them.

   3. Modify the web script so it counts from 0 up to the number of steps they requested minus 1.  So, if they ask for 5 steps, it outputs "0 1 2 3 4."

   4. Modify the web script so it calculates and outputs the percentages of red for each step.  Check these and make sure they're right: they start and end at the values specified by the user; there are the right number of steps; the steps are separated by the same amount.

   5. Add in the calculation of the green and blue values and check those.

   6. Use the calculated percentages to output the <div>s and make sure the colours look right.  Make sure the generated XHTML is valid.

   7. Add the checking for more than 150 steps.

I have attached the two files I have so far for this.

Please have a look and advise.

Thanks!

Jennine

 

 

 


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.9.0/50 - Release Date: 16/07/2005


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.9.0/50 - Release Date: 16/07/2005

Title: Colour Blend

Colour Blend

Colour 1

Red: %

Green: %

Blue: %

Colour 2

Red: %

Green: %

Blue: %

Steps

Number of steps:


Title: Colour Blend
import cgitb; cgitb.enable() import cgi form = cgi.FieldStorage() print "Content-type: text/html" print print """ """ print form int(["red1"].value),"%" print form int(["green1"].value),"%" print form int(["blue1"].value),"%" print form int(["red2"].value),"%" print form int(["green2"].value),"%" print form int(["blue2"].value),"%" for i in range(nsteps): print i, print """fraction = (i+1.0)/nsteps r = (1-fraction)*red1 + fraction*red2 g = (1-fraction)*green1 + fraction*green2 b = (1-fraction)*blue1 + fraction*green2"""

Colour Blend

Here is a mix of the two colours you specified:

Return to http://mail.python.org/mailman/listinfo/tutor

Reply via email to