Author Topic: Skidiot.h's challenge(In scripting language Python as he asked)  (Read 895 times)

0 Members and 1 Guest are viewing this topic.

Offline Uriah

  • Sir
  • ***
  • Posts: 454
  • Cookies: 42
  • άξονας
    • View Profile
Skidiot.h's challenge(In scripting language Python as he asked)
« on: November 16, 2012, 05:35:12 am »
Skidiot.h made a challenge recently to write a script that generates a custom homepage based off of criteria the user entered. Just finished this little script... I'm still a beginner at programming, and I haven't yet taken the time to perfect the program, but it does what it should. It does work, and maybe later i'll add in more criteria as well as make the interface more appealing.
 
Code: [Select]
# 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()       
Any feedback is much appreciated.
So...Skidiot.h... do I get my plus 5? :D
« Last Edit: November 16, 2012, 06:26:17 am by Uriah »

Offline iTpHo3NiX

  • EZ's Pirate Captain
  • Administrator
  • Titan
  • *
  • Posts: 2920
  • Cookies: 328
    • View Profile
    • EvilZone
Re: Skidiot.h's challenge(In scripting language Python as he asked)
« Reply #1 on: November 16, 2012, 08:31:13 am »
hehe i will test it out when i get some time for now +1 :P
[09:27] (+lenoch) iTpHo3NiX can even manipulate me to suck dick
[09:27] (+lenoch) oh no that's voluntary
[09:27] (+lenoch) sorry

Offline Uriah

  • Sir
  • ***
  • Posts: 454
  • Cookies: 42
  • άξονας
    • View Profile
Re: Skidiot.h's challenge(In scripting language Python as he asked)
« Reply #2 on: November 17, 2012, 04:07:01 am »
hehe i will test it out when i get some time for now +1 :P
Thanks :)
I kind of wrote this up quickly, I think I'll take some time to perfect the code and add more stuff. When you add a nice background it looks pretty good. I think I might post a screenshot in your original thread later.

Offline Uriah

  • Sir
  • ***
  • Posts: 454
  • Cookies: 42
  • άξονας
    • View Profile
Re: Skidiot.h's challenge(In scripting language Python as he asked)
« Reply #3 on: November 18, 2012, 05:25:17 am »

I believe Kulver said you can double post for updates:
Hey guys, just made a little update to the script. Added criteria for background color instead of just image, added a foot note option, a bit better formatted questioning, and the header can now be underlined. :D
Code: [Select]

# 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("3.Header Font Style?")
HFS = raw_input(" ")
print("4.Text Color?")
HTC = raw_input(" ")
print("3.Search Text? ")
ST = raw_input(" ")
print("5.Search Button Text?")
SBT = raw_input(" ")
print("6.Background Image?(Please name a valid PING or JPEG file.)")
BI = raw_input(" ")
print("7.Background color?(Skip if you have an image.)")
BC = raw_input(" ")
print("8.Words in page body?")
WP = raw_input(" ")
print("9.Font Style?")
PFS = raw_input(" ")
print("10.Text Color?")
PTC = raw_input(" ")
print("11.Would you like to underline your header? If so, type: u If not, type: n.")
U = raw_input(" ")
print("12.Would you like to add any foot notes? Type them in.")
FN = raw_input(" ")
print("13.Footnote color?")
FC = raw_input(" ")


# Status report to the user:
print("Website has been created!")
print("Now, just drag the 2 new files on your desktop into a folder that includes your background image!")
print("Enjoy!")
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><"""+U+""">"""+H+"""<"""+U+"""></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>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br />
<div id="footnote">"""
+FN+"""
<>
</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%;
    background-color:"""+BC+""";
}
h3{
    color:""" +PTC+""";
    font-family:""" +PFS+""";
}
#footnote{
    color:""" +FC+""";
}
""");
Y.close()


# End.

Here's a screen shot. I didn't fill in every criteria option for this one, and I'm using that background from Lucid in that post your desktop thread. Love that picture... using this as my homepage right now.
EDIT: Added a download if you guys want to use the proram. No gui or anything, just a text program. HPP stands for homepage program

« Last Edit: November 18, 2012, 08:11:24 am by Uriah »