Skip to content

Commit 4d99891

Browse files
add graphics and start tkinter
1 parent 749c3a7 commit 4d99891

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

src/VisualScript.py

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
from tkinter import *
55
import turtle
66

7+
tur = turtle
8+
79

810

911

@@ -18,12 +20,14 @@ def process_code(file):
1820
"convertInt":"int",
1921
"convertStr":"str",
2022
"else if":"elif",
21-
"//":"#"
23+
"//":"#",
24+
"get":"import"
2225

2326

2427
}
2528

26-
29+
def __init__(self):
30+
self = tur
2731
def add(num1, num2):
2832
x = num1+num2
2933
return x
@@ -42,10 +46,32 @@ def multiply(num1, num2):
4246
def divide(num1, num2):
4347
xyx = num1/num2
4448
return xyx
45-
def turtle(color):
46-
tur = turtle.Turtle()
47-
tur.color(color)
49+
def artboard(color):
50+
tur.turtle = turtle.Turtle()
51+
tur.turtle.color(color)
52+
return
53+
def artColor(color):
54+
tur.turtle.color(color)
55+
return
56+
def artLeft(amount):
57+
tur.turtle.left(amount)
58+
return
59+
def artRight(amount):
60+
tur.turtle.right(amount)
61+
return
62+
def artForward(amount):
63+
tur.turtle.forward(amount)
64+
return
65+
def artBackward(amount):
66+
tur.turtle.backward(amount)
67+
return
68+
def artClose():
69+
tur.turtle.exitonclick()
70+
return
71+
def artSpeed(speed):
72+
tur.turtle.speed(speed)
4873
return
74+
4975

5076

5177

src/example.vs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
// this is a comment
2+
get tkinter
23
log("Hello, World")
34

45
log(add(1, 2))
6+
turtle = ''
7+
artboard("red")
8+
artRight(1000)

0 commit comments

Comments
 (0)