aboutsummaryrefslogtreecommitdiff
path: root/challenge-165/eric-cheung/python/ch-1.py
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2022-05-17 22:29:15 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2022-05-17 22:29:15 +0100
commitb4b5157490c15311c02ceae025c53f13084beebf (patch)
tree42e43ca297a389df9e5aa854212a6a435d4ff219 /challenge-165/eric-cheung/python/ch-1.py
parent3fe16b9a4867884e4cc5bf7170bc22cd9dd41a82 (diff)
downloadperlweeklychallenge-club-b4b5157490c15311c02ceae025c53f13084beebf.tar.gz
perlweeklychallenge-club-b4b5157490c15311c02ceae025c53f13084beebf.tar.bz2
perlweeklychallenge-club-b4b5157490c15311c02ceae025c53f13084beebf.zip
- Added guest contributions by Eric Cheung.
Diffstat (limited to 'challenge-165/eric-cheung/python/ch-1.py')
-rwxr-xr-xchallenge-165/eric-cheung/python/ch-1.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/challenge-165/eric-cheung/python/ch-1.py b/challenge-165/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..153c2273e7
--- /dev/null
+++ b/challenge-165/eric-cheung/python/ch-1.py
@@ -0,0 +1,30 @@
+
+import os
+
+strOuputHTMLFile = "OutputSVG.html"
+
+if os.path.exists(strOuputHTMLFile):
+ os.remove(strOuputHTMLFile)
+
+os.system("echo ^<html^> >> " + strOuputHTMLFile)
+os.system("echo ^<body^> >> " + strOuputHTMLFile)
+
+os.system("echo ^<svg height = \"100\" width = \"100\"^> >> " + strOuputHTMLFile)
+
+while True:
+ objPoints = input("Input: ")
+
+ if not objPoints:
+ break
+
+ arrPoints = objPoints.split(",")
+ ## print (len(arrPoints))
+
+ if len(arrPoints) == 2:
+ os.system("echo ^<circle cx = " + "\"" + arrPoints[0] + "\" cy = \"" + arrPoints[1] + "\" r = \"4\" stroke = \"white\" stroke-width = \"1\" fill = \"red\" /^> >> " + strOuputHTMLFile)
+ elif len(arrPoints) == 4:
+ os.system("echo ^<line x1 = " + "\"" + arrPoints[0] + "\" y1 = \"" + arrPoints[1] + "\" x2 = \"" + arrPoints[2] + "\" y2 = \"" + arrPoints[3] + "\" style = \"stroke: rgb(0, 0, 255); stroke-width: 2\" /^> >> " + strOuputHTMLFile)
+
+os.system("echo ^</svg^> >> " + strOuputHTMLFile)
+os.system("echo ^</body^> >> " + strOuputHTMLFile)
+os.system("echo ^</html^> >> " + strOuputHTMLFile)