Skip to content

Commit 0c5b9a0

Browse files
added matplotlib features and better interface
1 parent 98714e1 commit 0c5b9a0

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

src/VisualScript.py

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import tkinter
55
from tkinter import *
66
import turtle
7-
import matplotlib
7+
import matplotlib.pyplot as plt
88
import django
99

1010
tur = turtle
@@ -96,21 +96,31 @@ def artStatic(feature):
9696
def ForeverRun():
9797
while True:
9898
pass
99-
def chart(datasetx, datasety):
100-
pass
99+
def chartLine(datasetx, datasety, ytitle, xtitle):
100+
plt.plot(datasetx, datasety)
101+
plt.ylabel(ytitle)
102+
plt.xlabel(xtitle)
103+
plt.show()
104+
def chartDot(datasetx, datasety, ytitle, xtitle):
105+
plt.scatter(datasetx, datasety)
106+
plt.xlabel(xtitle)
107+
plt.ylabel(ytitle)
108+
def chartScatter(datasetx, datasety):
109+
timesx = len(datasetx)
110+
for i in range(timesx):
111+
plt.scatter(datasetx[i], datasety[i])
112+
101113
def windowTitle(title):
102114
window.title(title)
103115
return
104-
def webCreate():
105-
pass
106-
def webButton():
107-
pass
108-
def webBackend():
109-
pass
110116
def ArtBoardTitle(name):
111117
screen = turtle.Screen()
112118
screen.title(name)
113119
return
120+
def ChartShow():
121+
plt.show()
122+
return
123+
114124

115125

116126

@@ -139,16 +149,20 @@ def ArtBoardTitle(name):
139149
feature_func()
140150

141151

142-
print("VisualScipt\nEnter a filename or exit to exit")
152+
print("VisualScipt\nEnter a filename or license for license or help() for help or exit() to exit")
143153
if __name__ == "__main__":
144154
while True:
145155
filename = input(">>> ")
146-
if filename.lower() == 'exit':
156+
if filename.lower() == 'exit()':
147157
break
158+
elif filename.lower() == 'help()':
159+
print("\nexit() to exit or enter to go back\n")
160+
elif filename.lower() == 'license':
161+
print("\nVisualScript is lisensed under a MIT license.\nRead the terms here:\nhttps://github.com/Bruceli-iscool/VisualScript/blob/main/LICENSE\n")
148162
try:
149163
process_code(filename)
150164
except Exception as e:
151-
if len(filename) < 1:
165+
if len(filename) < 1 or filename == 'help()' or filename == 'license':
152166
pass
153167
else:
154168
print(f"An error occurred: {e}")

src/example.vs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ get tkinter with_name john
33
log("Hello, World")
44

55
log(add(1, 2))
6-
artboard("red")
7-
artLeft(500)
8-
artForward(100)
6+
chartLine([1, 2, 3, 4], [2, 4, 6, 8], "", "")
7+
x = [1, 2, 3]
8+
y = [1, 2, 3]
9+
chartScatter(x, y)

0 commit comments

Comments
 (0)