Some of you guys may have seen that python program I wrote to create a Home page based off of criteria. I'm trying to add to it and allow for the user to to decide the length of the search bar and the amount of line breaks between each element of the page. Right now they can only choose fonts, background images and colors, words displayed, and colors.
The problem with me allowing positioning is that I can't just set in a variable, because line breaks and etc. are not set by names, but my quantity, if that makes sense.
I can do an a trillion if else and else if statements, each writing a completely different html code based off of an input, but that would be a little too much.
Here's the code:
# File name: Ez.py
# Criteria Query:
print("Welcome! Please insert the required criteria to create your own, custom homepage!")
print("1.Title?")
T = raw_input(" ")
print("2.Header? ")
H = raw_input(" ")
print("Header Font Style?")
HFS = raw_input(" ")
print("Text Color?")
HTC = raw_input(" ")
print("3.Search Text? ")
ST = raw_input(" ")
print("4.Search Button Text?")
SBT = raw_input(" ")
print("5.Background Image?(Please name a valid PING or JPEG file.)")
BI = raw_input(" ")
print("6.Words on Page?")
WP = raw_input(" ")
print("Font Style?")
PFS = raw_input(" ")
print("Text Color?")
PTC = raw_input(" ")
# Status report to the user:
print("Website has been created!")
print(T, H, HFS, HTC, ST, SBT, BI, WP, PFS, PTC)
print("Now, just drag the 2 new files on your desktop into a folder that includes your background image!")
raw_input("Press ENTER to quit. ")
# Creating the hypertext mark up language:
X = open("Homepage.html", "wb")
X.write( """
<!doctype html>
<html>
<title>"""+T+"""</title>
<link rel=\"stylesheet\" type=\"text/css\" href=\"Homepage.css\" />
<body>
<center>
<h1>"""+H+"""</h1>
<br />
<form method=\"get\" action=\"http://www.google.com/search\">
<input onfocus="this.value=\'\'\" type=\"text\" name=\"q\" size=\"45\"
maxlength=\"255\" value=\""""+ST+"""\" />
<input type=\"submit\" value=\""""+SBT+"""\" />
</form>
<br /><br /><br /><br /><br />
<div id=\"Main\">
<h3>"""
+WP+
"""</h3>
<>
</center>
</body>
</html>
""");
X.close()
# Creating the cascading style sheet:
Y = open("Homepage.css", "wb")
Y.write("""
h1{
color: """ +HTC+ """;
font-family: """ +HFS+ """;
}
body{
background: url("""+BI+""");
background-attachment: fixed;
background-position: 27% 27%;
}
h3{
color:""" +PTC+""";
font-family:""" +PFS+""";
}
}""");
Y.close()
#End.
Any ideas?