scratch-syntax 0.7.4__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {scratch_syntax-0.7.4/src/scratch_syntax.egg-info → scratch_syntax-0.8.0}/PKG-INFO +15 -9
- {scratch_syntax-0.7.4 → scratch_syntax-0.8.0}/README.md +14 -8
- {scratch_syntax-0.7.4 → scratch_syntax-0.8.0}/pyproject.toml +1 -1
- scratch_syntax-0.8.0/src/scratch_syntax/core.py +104 -0
- {scratch_syntax-0.7.4 → scratch_syntax-0.8.0/src/scratch_syntax.egg-info}/PKG-INFO +15 -9
- scratch_syntax-0.7.4/src/scratch_syntax/core.py +0 -95
- {scratch_syntax-0.7.4 → scratch_syntax-0.8.0}/LICENSE +0 -0
- {scratch_syntax-0.7.4 → scratch_syntax-0.8.0}/setup.cfg +0 -0
- {scratch_syntax-0.7.4 → scratch_syntax-0.8.0}/src/scratch_syntax/__init__.py +0 -0
- {scratch_syntax-0.7.4 → scratch_syntax-0.8.0}/src/scratch_syntax.egg-info/SOURCES.txt +0 -0
- {scratch_syntax-0.7.4 → scratch_syntax-0.8.0}/src/scratch_syntax.egg-info/dependency_links.txt +0 -0
- {scratch_syntax-0.7.4 → scratch_syntax-0.8.0}/src/scratch_syntax.egg-info/requires.txt +0 -0
- {scratch_syntax-0.7.4 → scratch_syntax-0.8.0}/src/scratch_syntax.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scratch_syntax
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: A syntax library designed to help scratch users transition to python
|
|
5
5
|
Author-email: Cade <cadey.matignas@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/cadeymatignas-source/scratch_syntax
|
|
@@ -27,7 +27,7 @@ you can do anything with this library, mod it, break it, anything, but don't sue
|
|
|
27
27
|
|
|
28
28
|
## Update 0.2.0 notes
|
|
29
29
|
|
|
30
|
-
I removed the forever and repeat functions because they didnt work and added the stop_all() function. You can use
|
|
30
|
+
I removed the forever and repeat functions because they didnt work and added the `stop_all()` function. You can use `for_ in range():` for repeat and `while True:` for forever
|
|
31
31
|
|
|
32
32
|
# Updating
|
|
33
33
|
|
|
@@ -41,13 +41,13 @@ pip install --upgrade scratch_syntax
|
|
|
41
41
|
|
|
42
42
|
## Update 0.4.0 notes
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
- Added new say_for_seconds() function
|
|
45
45
|
|
|
46
46
|
- I also added Github Respitory
|
|
47
47
|
|
|
48
48
|
## Update 0.5.0
|
|
49
49
|
|
|
50
|
-
- Added new wait_until() function
|
|
50
|
+
- Added new `wait_until()` function
|
|
51
51
|
|
|
52
52
|
## Update 0.6.0\. ReRun's UPDATE!!!
|
|
53
53
|
|
|
@@ -61,11 +61,11 @@ pip install --upgrade scratch_syntax
|
|
|
61
61
|
repeat_until(lambda: say("do you like this?"), lambda: condition())
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
Also btw don't forget to put from scratch_syntax import
|
|
64
|
+
Also btw don't forget to put from `scratch_syntax import *`so the functions run correctly as is
|
|
65
65
|
|
|
66
66
|
## Update 0.7.0 notes. Keyboard update!!!
|
|
67
67
|
|
|
68
|
-
- Added keyboard function
|
|
68
|
+
- Added keyboard function `when_key_pressed()`!!!
|
|
69
69
|
|
|
70
70
|
## Update 0.7.2 note:
|
|
71
71
|
|
|
@@ -77,12 +77,16 @@ Also btw don't forget to put from scratch_syntax import * so the functions run c
|
|
|
77
77
|
|
|
78
78
|
## UPDATE 0.7.4: minor fixes
|
|
79
79
|
|
|
80
|
-
- Fixed the
|
|
80
|
+
- Fixed the `wait_unti()`l a bitl
|
|
81
|
+
|
|
82
|
+
## Update 0.8.0: New function
|
|
83
|
+
|
|
84
|
+
- I added the `when_key_pressed_all()` function -I fixed the `wait_until()` function a bit
|
|
81
85
|
|
|
82
86
|
## All Functions
|
|
83
87
|
|
|
84
88
|
```bash
|
|
85
|
-
say(), ask(), wait(), pick_random_number_from(), stop_all(), add_to_list(), insert_in_list(), delete_from_list(), delete_all_from_list(), replace_from_list(), answer(), say_for_seconds(), wait_until(), repeat(), forever(), repeat_until(), when_key_pressed()
|
|
89
|
+
say(), ask(), wait(), pick_random_number_from(), stop_all(), add_to_list(), insert_in_list(), delete_from_list(), delete_all_from_list(), replace_from_list(), answer(), say_for_seconds(), wait_until(), repeat(), forever(), repeat_until(), when_key_pressed(), when_key_pressed_all()
|
|
86
90
|
```
|
|
87
91
|
|
|
88
92
|
Also heres an example code
|
|
@@ -105,5 +109,7 @@ say("done!")
|
|
|
105
109
|
say("now it is time for us to part!")
|
|
106
110
|
repeat_until(lambda: ask("would you like to leave?"), lambda: answer() == "yes")
|
|
107
111
|
wait(1)
|
|
108
|
-
|
|
112
|
+
say("press any key to exit")
|
|
113
|
+
if when_key_pressed_any():
|
|
114
|
+
stop_all()
|
|
109
115
|
```
|
|
@@ -12,7 +12,7 @@ you can do anything with this library, mod it, break it, anything, but don't sue
|
|
|
12
12
|
|
|
13
13
|
## Update 0.2.0 notes
|
|
14
14
|
|
|
15
|
-
I removed the forever and repeat functions because they didnt work and added the stop_all() function. You can use
|
|
15
|
+
I removed the forever and repeat functions because they didnt work and added the `stop_all()` function. You can use `for_ in range():` for repeat and `while True:` for forever
|
|
16
16
|
|
|
17
17
|
# Updating
|
|
18
18
|
|
|
@@ -26,13 +26,13 @@ pip install --upgrade scratch_syntax
|
|
|
26
26
|
|
|
27
27
|
## Update 0.4.0 notes
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
- Added new say_for_seconds() function
|
|
30
30
|
|
|
31
31
|
- I also added Github Respitory
|
|
32
32
|
|
|
33
33
|
## Update 0.5.0
|
|
34
34
|
|
|
35
|
-
- Added new wait_until() function
|
|
35
|
+
- Added new `wait_until()` function
|
|
36
36
|
|
|
37
37
|
## Update 0.6.0\. ReRun's UPDATE!!!
|
|
38
38
|
|
|
@@ -46,11 +46,11 @@ pip install --upgrade scratch_syntax
|
|
|
46
46
|
repeat_until(lambda: say("do you like this?"), lambda: condition())
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
Also btw don't forget to put from scratch_syntax import
|
|
49
|
+
Also btw don't forget to put from `scratch_syntax import *`so the functions run correctly as is
|
|
50
50
|
|
|
51
51
|
## Update 0.7.0 notes. Keyboard update!!!
|
|
52
52
|
|
|
53
|
-
- Added keyboard function
|
|
53
|
+
- Added keyboard function `when_key_pressed()`!!!
|
|
54
54
|
|
|
55
55
|
## Update 0.7.2 note:
|
|
56
56
|
|
|
@@ -62,12 +62,16 @@ Also btw don't forget to put from scratch_syntax import * so the functions run c
|
|
|
62
62
|
|
|
63
63
|
## UPDATE 0.7.4: minor fixes
|
|
64
64
|
|
|
65
|
-
- Fixed the
|
|
65
|
+
- Fixed the `wait_unti()`l a bitl
|
|
66
|
+
|
|
67
|
+
## Update 0.8.0: New function
|
|
68
|
+
|
|
69
|
+
- I added the `when_key_pressed_all()` function -I fixed the `wait_until()` function a bit
|
|
66
70
|
|
|
67
71
|
## All Functions
|
|
68
72
|
|
|
69
73
|
```bash
|
|
70
|
-
say(), ask(), wait(), pick_random_number_from(), stop_all(), add_to_list(), insert_in_list(), delete_from_list(), delete_all_from_list(), replace_from_list(), answer(), say_for_seconds(), wait_until(), repeat(), forever(), repeat_until(), when_key_pressed()
|
|
74
|
+
say(), ask(), wait(), pick_random_number_from(), stop_all(), add_to_list(), insert_in_list(), delete_from_list(), delete_all_from_list(), replace_from_list(), answer(), say_for_seconds(), wait_until(), repeat(), forever(), repeat_until(), when_key_pressed(), when_key_pressed_all()
|
|
71
75
|
```
|
|
72
76
|
|
|
73
77
|
Also heres an example code
|
|
@@ -90,5 +94,7 @@ say("done!")
|
|
|
90
94
|
say("now it is time for us to part!")
|
|
91
95
|
repeat_until(lambda: ask("would you like to leave?"), lambda: answer() == "yes")
|
|
92
96
|
wait(1)
|
|
93
|
-
|
|
97
|
+
say("press any key to exit")
|
|
98
|
+
if when_key_pressed_any():
|
|
99
|
+
stop_all()
|
|
94
100
|
```
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
__lazy_modules__ = ["random", "time", "sys", "keyboard"]
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
from random import randint
|
|
5
|
+
from time import sleep
|
|
6
|
+
|
|
7
|
+
from keyboard import is_pressed, read_key
|
|
8
|
+
|
|
9
|
+
_scratch_data = {"answer": ""}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def say(text):
|
|
13
|
+
"""This function says text. etc. say("hello")"""
|
|
14
|
+
print(text)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def say_for_seconds(texty, secs):
|
|
18
|
+
"""This function is basically saying text then waiting. etc. say_for_seconds("hello", 2)"""
|
|
19
|
+
print(texty)
|
|
20
|
+
sleep(secs)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def ask(question):
|
|
24
|
+
"""This one is like scratch's ask then wait function"""
|
|
25
|
+
_scratch_data["answer"] = input(question)
|
|
26
|
+
return _scratch_data["answer"]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def answer():
|
|
30
|
+
return _scratch_data["answer"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def wait(seconds):
|
|
34
|
+
"""This function waits. etc. wait(1)"""
|
|
35
|
+
sleep(seconds)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def pick_random_number_from(a, b):
|
|
39
|
+
"""Picks a random number. example: pick_random_numer_from(1,100)"""
|
|
40
|
+
return randint(a, b)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def stop_all():
|
|
44
|
+
sys.exit(0)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def add_to_list(listname, item):
|
|
48
|
+
listname.append(item)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def insert_in_list(listname, index, item):
|
|
52
|
+
listname.insert(index, item)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def delete_from_list(listname, index):
|
|
56
|
+
listname.pop(index)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def delete_all_from_list(listname):
|
|
60
|
+
listname.clear()
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def replace_in_list(listname, index, item):
|
|
64
|
+
listname[index] = item
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def wait_until(condit):
|
|
68
|
+
while not condit:
|
|
69
|
+
sleep(0.01)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def repeat(action, timy):
|
|
73
|
+
for _ in range(timy):
|
|
74
|
+
action()
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def forever(actiono):
|
|
78
|
+
while True:
|
|
79
|
+
actiono()
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def repeat_until(actionon, condition):
|
|
83
|
+
"""This one repeats until condition becomes true"""
|
|
84
|
+
while True:
|
|
85
|
+
actionon()
|
|
86
|
+
if condition():
|
|
87
|
+
break
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def when_key_pressed(key):
|
|
91
|
+
"""This function checks when key is pressed"""
|
|
92
|
+
if is_pressed(key):
|
|
93
|
+
sleep(0.01)
|
|
94
|
+
return True
|
|
95
|
+
return False
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def when_key_pressed_any():
|
|
99
|
+
"""This function checks when any key is pressed"""
|
|
100
|
+
key = read_key()
|
|
101
|
+
if key:
|
|
102
|
+
sleep(0.01)
|
|
103
|
+
return True
|
|
104
|
+
return False
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scratch_syntax
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: A syntax library designed to help scratch users transition to python
|
|
5
5
|
Author-email: Cade <cadey.matignas@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/cadeymatignas-source/scratch_syntax
|
|
@@ -27,7 +27,7 @@ you can do anything with this library, mod it, break it, anything, but don't sue
|
|
|
27
27
|
|
|
28
28
|
## Update 0.2.0 notes
|
|
29
29
|
|
|
30
|
-
I removed the forever and repeat functions because they didnt work and added the stop_all() function. You can use
|
|
30
|
+
I removed the forever and repeat functions because they didnt work and added the `stop_all()` function. You can use `for_ in range():` for repeat and `while True:` for forever
|
|
31
31
|
|
|
32
32
|
# Updating
|
|
33
33
|
|
|
@@ -41,13 +41,13 @@ pip install --upgrade scratch_syntax
|
|
|
41
41
|
|
|
42
42
|
## Update 0.4.0 notes
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
- Added new say_for_seconds() function
|
|
45
45
|
|
|
46
46
|
- I also added Github Respitory
|
|
47
47
|
|
|
48
48
|
## Update 0.5.0
|
|
49
49
|
|
|
50
|
-
- Added new wait_until() function
|
|
50
|
+
- Added new `wait_until()` function
|
|
51
51
|
|
|
52
52
|
## Update 0.6.0\. ReRun's UPDATE!!!
|
|
53
53
|
|
|
@@ -61,11 +61,11 @@ pip install --upgrade scratch_syntax
|
|
|
61
61
|
repeat_until(lambda: say("do you like this?"), lambda: condition())
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
Also btw don't forget to put from scratch_syntax import
|
|
64
|
+
Also btw don't forget to put from `scratch_syntax import *`so the functions run correctly as is
|
|
65
65
|
|
|
66
66
|
## Update 0.7.0 notes. Keyboard update!!!
|
|
67
67
|
|
|
68
|
-
- Added keyboard function
|
|
68
|
+
- Added keyboard function `when_key_pressed()`!!!
|
|
69
69
|
|
|
70
70
|
## Update 0.7.2 note:
|
|
71
71
|
|
|
@@ -77,12 +77,16 @@ Also btw don't forget to put from scratch_syntax import * so the functions run c
|
|
|
77
77
|
|
|
78
78
|
## UPDATE 0.7.4: minor fixes
|
|
79
79
|
|
|
80
|
-
- Fixed the
|
|
80
|
+
- Fixed the `wait_unti()`l a bitl
|
|
81
|
+
|
|
82
|
+
## Update 0.8.0: New function
|
|
83
|
+
|
|
84
|
+
- I added the `when_key_pressed_all()` function -I fixed the `wait_until()` function a bit
|
|
81
85
|
|
|
82
86
|
## All Functions
|
|
83
87
|
|
|
84
88
|
```bash
|
|
85
|
-
say(), ask(), wait(), pick_random_number_from(), stop_all(), add_to_list(), insert_in_list(), delete_from_list(), delete_all_from_list(), replace_from_list(), answer(), say_for_seconds(), wait_until(), repeat(), forever(), repeat_until(), when_key_pressed()
|
|
89
|
+
say(), ask(), wait(), pick_random_number_from(), stop_all(), add_to_list(), insert_in_list(), delete_from_list(), delete_all_from_list(), replace_from_list(), answer(), say_for_seconds(), wait_until(), repeat(), forever(), repeat_until(), when_key_pressed(), when_key_pressed_all()
|
|
86
90
|
```
|
|
87
91
|
|
|
88
92
|
Also heres an example code
|
|
@@ -105,5 +109,7 @@ say("done!")
|
|
|
105
109
|
say("now it is time for us to part!")
|
|
106
110
|
repeat_until(lambda: ask("would you like to leave?"), lambda: answer() == "yes")
|
|
107
111
|
wait(1)
|
|
108
|
-
|
|
112
|
+
say("press any key to exit")
|
|
113
|
+
if when_key_pressed_any():
|
|
114
|
+
stop_all()
|
|
109
115
|
```
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
__lazy_modules__ = ["random", "time", "sys", "keyboard"]
|
|
2
|
-
|
|
3
|
-
import sys
|
|
4
|
-
from random import randint
|
|
5
|
-
from time import sleep
|
|
6
|
-
|
|
7
|
-
from keyboard import is_pressed
|
|
8
|
-
|
|
9
|
-
_scratch_data = {"answer": ""}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def say(text):
|
|
13
|
-
"""This function says text. etc. say("hello")"""
|
|
14
|
-
print(text)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def say_for_seconds(texty, secs):
|
|
18
|
-
"""This function is basically saying text then waiting. etc. say_for_seconds("hello", 2)"""
|
|
19
|
-
print(texty)
|
|
20
|
-
sleep(secs)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def ask(question):
|
|
24
|
-
"""This one is like scratch's ask then wait function"""
|
|
25
|
-
_scratch_data["answer"] = input(question)
|
|
26
|
-
return _scratch_data["answer"]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def answer():
|
|
30
|
-
return _scratch_data["answer"]
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def wait(seconds):
|
|
34
|
-
"""This function waits. etc. wait(1)"""
|
|
35
|
-
sleep(seconds)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def pick_random_number_from(a, b):
|
|
39
|
-
"""Picks a random number. example: pick_random_numer_from(1,100)"""
|
|
40
|
-
return randint(a, b)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def stop_all():
|
|
44
|
-
sys.exit(0)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def add_to_list(listname, item):
|
|
48
|
-
listname.append(item)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def insert_in_list(listname, index, item):
|
|
52
|
-
listname.insert(index, item)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def delete_from_list(listname, index):
|
|
56
|
-
listname.pop(index)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def delete_all_from_list(listname):
|
|
60
|
-
listname.clear()
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def replace_in_list(listname, index, item):
|
|
64
|
-
listname[index] = item
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def wait_until(condit):
|
|
68
|
-
while not condit():
|
|
69
|
-
sleep(0.01)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
def repeat(action, timy):
|
|
73
|
-
for _ in range(timy):
|
|
74
|
-
action()
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
def forever(actiono):
|
|
78
|
-
while True:
|
|
79
|
-
actiono()
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
def repeat_until(actionon, condition):
|
|
83
|
-
"""This one repeats until condition becomes true"""
|
|
84
|
-
while True:
|
|
85
|
-
actionon()
|
|
86
|
-
if condition():
|
|
87
|
-
break
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
def when_key_pressed(key):
|
|
91
|
-
"""This function checks when key is pressed"""
|
|
92
|
-
if is_pressed(key):
|
|
93
|
-
sleep(0.01)
|
|
94
|
-
return True
|
|
95
|
-
return False
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scratch_syntax-0.7.4 → scratch_syntax-0.8.0}/src/scratch_syntax.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|