Skip to content

Commit f1f2ed3

Browse files
added and fixed web pages
1 parent 829d36f commit f1f2ed3

File tree

7 files changed

+45
-6
lines changed

7 files changed

+45
-6
lines changed

src/.VisualScript.py.swp

-4 KB
Binary file not shown.

src/.VisualScript.py.un~

6.9 KB
Binary file not shown.

src/.example.vs.un~

3.98 KB
Binary file not shown.

src/VisualScript.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import matplotlib.pyplot as plt
88
import sys
99
from statistics import *
10-
fro flask import *
10+
from flask import *
1111
import webbrowser
1212

1313
tur = turtle
@@ -159,21 +159,21 @@ def returnMean(list):
159159
sortedlist = sorted(list)
160160
meannum = sum(sortedlist) / len(sortedlist)
161161
return meannum
162-
def webPage(title, header, content, contentt=None, contenttr=None, contentb=None, contenth=None, contentcb=None, cssfile=None, filename="index.html"):
162+
def webPage(title=, header, content, contentt="", contenttr="", contentb="", contenth="", contentcb="", cssfile=None, filename="index.html"):
163163
filenamecustom = filename
164164
structure = f"""
165165
<!DOCTOTYPE html>
166166
<html>
167167
<head>
168-
<titiel>{title}</title>
168+
<title>{title}</title>
169169
<link rel="stylesheet" type="text/css" href="{cssfile}">
170170
</head>
171171
<body>
172172
<h1>{header}</h1>
173173
<p>{content}</p>
174174
<p>{contentt}</p>
175175
<p>{contenttr}</p>
176-
<p>{contenttb}</p>
176+
<p>{contentb}</p>
177177
<p>{contenth}</p>
178178
<p>{contentcb}</p>
179179
</body>

src/VisualScript.py~

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import turtle
77
import matplotlib.pyplot as plt
88
import sys
99
from statistics import *
10-
fro flask import *
10+
from flask import *
11+
import webbrowser
1112

1213
tur = turtle
1314

@@ -158,7 +159,37 @@ def process_code(file):
158159
sortedlist = sorted(list)
159160
meannum = sum(sortedlist) / len(sortedlist)
160161
return meannum
161-
def
162+
def webPage(title, header, content, contentt=None, contenttr=None, contentb=None, contenth=None, contentcb=None, cssfile=None, filename="index.html"):
163+
filenamecustom = filename
164+
structure = f"""
165+
<!DOCTOTYPE html>
166+
<html>
167+
<head>
168+
<titiel>{title}</title>
169+
<link rel="stylesheet" type="text/css" href="{cssfile}">
170+
</head>
171+
<body>
172+
<h1>{header}</h1>
173+
<p>{content}</p>
174+
<p>{contentt}</p>
175+
<p>{contenttr}</p>
176+
<p>{contentb}</p>
177+
<p>{contenth}</p>
178+
<p>{contentcb}</p>
179+
</body>
180+
</html>
181+
"""
182+
183+
with open(filename, "w") as html:
184+
html.write(structure)
185+
webbrowser.open(filename)
186+
187+
def webPageStart(filename):
188+
# opens html files only
189+
webbrowser.open(filename)
190+
191+
192+
162193

163194

164195

src/example.vs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ x = returnMedian(list, "y")
44
log(x)
55
function print():
66
log("hello world")
7+
content = "john"
8+
webPage("steve", "tim", "timmy")

src/example.vs~

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// this is a comment
2+
list = [1, 2, 3, 4, 5, 6 , 7, 8, 9, 10, 10, 12, 11]
3+
x = returnMedian(list, "y")
4+
log(x)
5+
function print():
6+
log("hello world")

0 commit comments

Comments
 (0)