#And now here's another program that generates a #more substantial web page: The user first #prepares a brief biography file with the name #on the first line, followed by several paragraphs #of description, one per line. The program prompts #the user to select this file as well as a picture, #and then assembles the HTML. def generateWebPage(): showInformation("Select the bio file.") bio=pickAFile() biofile=open(bio,"rt") biolines=biofile.readlines() name=biolines[0] #eliminate last character (newline) name=name[0:-1] showInformation("Select the picture file") picfile=pickAFile() pic=makePicture(picfile) width=pic.getWidth() height=pic.getHeight() showInformation("Select destination folder for your web page.") dir=pickAFolder() #We use open to create the html file. outfile=open(dir+"/"+name+".html","wt") #We generate the header information and the page #title. outfile.write("\n\n\n") outfile.write(name+"'s Home Page") outfile.write("\n\n") scaled_height=200*height/width outfile.write('

') outfile.write('    '+name+'

') for lineNumber in range(1,len(biolines)): outfile.write('
'+biolines[lineNumber]) outfile.write('') outfile.close()