scratch-syntax 0.7.3__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.3/src/scratch_syntax.egg-info → scratch_syntax-0.8.0}/PKG-INFO +41 -34
- scratch_syntax-0.8.0/README.md +100 -0
- {scratch_syntax-0.7.3 → 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.3 → scratch_syntax-0.8.0/src/scratch_syntax.egg-info}/PKG-INFO +41 -34
- scratch_syntax-0.7.3/README.md +0 -93
- scratch_syntax-0.7.3/src/scratch_syntax/core.py +0 -95
- {scratch_syntax-0.7.3 → scratch_syntax-0.8.0}/LICENSE +0 -0
- {scratch_syntax-0.7.3 → scratch_syntax-0.8.0}/setup.cfg +0 -0
- {scratch_syntax-0.7.3 → scratch_syntax-0.8.0}/src/scratch_syntax/__init__.py +0 -0
- {scratch_syntax-0.7.3 → scratch_syntax-0.8.0}/src/scratch_syntax.egg-info/SOURCES.txt +0 -0
- {scratch_syntax-0.7.3 → scratch_syntax-0.8.0}/src/scratch_syntax.egg-info/dependency_links.txt +0 -0
- {scratch_syntax-0.7.3 → scratch_syntax-0.8.0}/src/scratch_syntax.egg-info/requires.txt +0 -0
- {scratch_syntax-0.7.3 → 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
|
|
@@ -20,72 +20,77 @@ Dynamic: license-file
|
|
|
20
20
|
# Installation
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
|
|
24
23
|
pip install scratch_syntax
|
|
25
|
-
|
|
26
24
|
```
|
|
27
25
|
|
|
28
26
|
you can do anything with this library, mod it, break it, anything, but don't sue me
|
|
29
27
|
|
|
30
28
|
## Update 0.2.0 notes
|
|
31
29
|
|
|
32
|
-
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
|
|
33
31
|
|
|
34
32
|
# Updating
|
|
35
33
|
|
|
36
34
|
```bash
|
|
37
|
-
|
|
38
35
|
pip install --upgrade scratch_syntax
|
|
39
|
-
|
|
40
36
|
```
|
|
41
37
|
|
|
42
38
|
## Update 0.3.0 notes
|
|
43
|
-
* I added the list functions
|
|
44
|
-
|
|
45
39
|
|
|
40
|
+
- I added the list functions
|
|
46
41
|
|
|
47
42
|
## Update 0.4.0 notes
|
|
48
43
|
|
|
49
|
-
|
|
44
|
+
- Added new say_for_seconds() function
|
|
50
45
|
|
|
51
|
-
|
|
46
|
+
- I also added Github Respitory
|
|
52
47
|
|
|
53
48
|
## Update 0.5.0
|
|
54
|
-
* Added new wait_until() function
|
|
55
49
|
|
|
50
|
+
- Added new `wait_until()` function
|
|
56
51
|
|
|
57
|
-
## Update 0.6.0
|
|
58
|
-
* The return of classic repeats... in a different way!!!
|
|
59
|
-
* Added new repeat_until() function!!!
|
|
60
|
-
* Now needs the lambda function. etc:
|
|
61
|
-
```bash
|
|
52
|
+
## Update 0.6.0\. ReRun's UPDATE!!!
|
|
62
53
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
- The return of classic repeats... in a different way!!!
|
|
55
|
+
- Added new repeat_until() function!!!
|
|
56
|
+
- Now needs the lambda function. etc:
|
|
66
57
|
|
|
67
|
-
|
|
58
|
+
```python
|
|
59
|
+
repeat(lambda: say("hello!"), 5)
|
|
60
|
+
forever(lambda: say("hiya!"))
|
|
61
|
+
repeat_until(lambda: say("do you like this?"), lambda: condition())
|
|
62
|
+
```
|
|
68
63
|
|
|
69
|
-
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
|
|
70
65
|
|
|
71
66
|
## Update 0.7.0 notes. Keyboard update!!!
|
|
72
|
-
|
|
67
|
+
|
|
68
|
+
- Added keyboard function `when_key_pressed()`!!!
|
|
73
69
|
|
|
74
70
|
## Update 0.7.2 note:
|
|
75
|
-
|
|
71
|
+
|
|
72
|
+
- I changed the wait_until function a bit so now it goes `wait_until(condition)` instead of `wait_until(action, condition)`
|
|
76
73
|
|
|
77
74
|
## Update 0.7.3:
|
|
78
|
-
* Made the ```when_key_pressed()``` and ```wait_until()``` functions faster
|
|
79
75
|
|
|
76
|
+
- Made the `when_key_pressed()` and `wait_until()` functions faster
|
|
80
77
|
|
|
81
|
-
|
|
82
|
-
# All Functions
|
|
78
|
+
## UPDATE 0.7.4: minor fixes
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
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
|
|
85
|
+
|
|
86
|
+
## All Functions
|
|
86
87
|
|
|
88
|
+
```bash
|
|
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()
|
|
87
90
|
```
|
|
91
|
+
|
|
88
92
|
Also heres an example code
|
|
93
|
+
|
|
89
94
|
```python
|
|
90
95
|
from scratch_syntax import *
|
|
91
96
|
|
|
@@ -94,15 +99,17 @@ ask("hmm what do you think? answer yes please ")
|
|
|
94
99
|
wait_until(answer() == "yes")
|
|
95
100
|
say("hahaha no way you said it!!!")
|
|
96
101
|
repeat_until(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
lambda: (
|
|
103
|
+
say_for_seconds("hello guys!", 1),
|
|
104
|
+
ask("stop running?"),
|
|
105
|
+
),
|
|
106
|
+
lambda: answer() == "yes",
|
|
102
107
|
)
|
|
103
108
|
say("done!")
|
|
104
109
|
say("now it is time for us to part!")
|
|
105
110
|
repeat_until(lambda: ask("would you like to leave?"), lambda: answer() == "yes")
|
|
106
111
|
wait(1)
|
|
107
|
-
|
|
112
|
+
say("press any key to exit")
|
|
113
|
+
if when_key_pressed_any():
|
|
114
|
+
stop_all()
|
|
108
115
|
```
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Scratch_Syntax
|
|
2
|
+
|
|
3
|
+
## This is a custom Python library designed to make python syntax more like scratch.
|
|
4
|
+
|
|
5
|
+
# Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install scratch_syntax
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
you can do anything with this library, mod it, break it, anything, but don't sue me
|
|
12
|
+
|
|
13
|
+
## Update 0.2.0 notes
|
|
14
|
+
|
|
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
|
+
|
|
17
|
+
# Updating
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install --upgrade scratch_syntax
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Update 0.3.0 notes
|
|
24
|
+
|
|
25
|
+
- I added the list functions
|
|
26
|
+
|
|
27
|
+
## Update 0.4.0 notes
|
|
28
|
+
|
|
29
|
+
- Added new say_for_seconds() function
|
|
30
|
+
|
|
31
|
+
- I also added Github Respitory
|
|
32
|
+
|
|
33
|
+
## Update 0.5.0
|
|
34
|
+
|
|
35
|
+
- Added new `wait_until()` function
|
|
36
|
+
|
|
37
|
+
## Update 0.6.0\. ReRun's UPDATE!!!
|
|
38
|
+
|
|
39
|
+
- The return of classic repeats... in a different way!!!
|
|
40
|
+
- Added new repeat_until() function!!!
|
|
41
|
+
- Now needs the lambda function. etc:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
repeat(lambda: say("hello!"), 5)
|
|
45
|
+
forever(lambda: say("hiya!"))
|
|
46
|
+
repeat_until(lambda: say("do you like this?"), lambda: condition())
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Also btw don't forget to put from `scratch_syntax import *`so the functions run correctly as is
|
|
50
|
+
|
|
51
|
+
## Update 0.7.0 notes. Keyboard update!!!
|
|
52
|
+
|
|
53
|
+
- Added keyboard function `when_key_pressed()`!!!
|
|
54
|
+
|
|
55
|
+
## Update 0.7.2 note:
|
|
56
|
+
|
|
57
|
+
- I changed the wait_until function a bit so now it goes `wait_until(condition)` instead of `wait_until(action, condition)`
|
|
58
|
+
|
|
59
|
+
## Update 0.7.3:
|
|
60
|
+
|
|
61
|
+
- Made the `when_key_pressed()` and `wait_until()` functions faster
|
|
62
|
+
|
|
63
|
+
## UPDATE 0.7.4: minor fixes
|
|
64
|
+
|
|
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
|
|
70
|
+
|
|
71
|
+
## All Functions
|
|
72
|
+
|
|
73
|
+
```bash
|
|
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()
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Also heres an example code
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from scratch_syntax import *
|
|
81
|
+
|
|
82
|
+
say("welcome to this beautiful thing!")
|
|
83
|
+
ask("hmm what do you think? answer yes please ")
|
|
84
|
+
wait_until(answer() == "yes")
|
|
85
|
+
say("hahaha no way you said it!!!")
|
|
86
|
+
repeat_until(
|
|
87
|
+
lambda: (
|
|
88
|
+
say_for_seconds("hello guys!", 1),
|
|
89
|
+
ask("stop running?"),
|
|
90
|
+
),
|
|
91
|
+
lambda: answer() == "yes",
|
|
92
|
+
)
|
|
93
|
+
say("done!")
|
|
94
|
+
say("now it is time for us to part!")
|
|
95
|
+
repeat_until(lambda: ask("would you like to leave?"), lambda: answer() == "yes")
|
|
96
|
+
wait(1)
|
|
97
|
+
say("press any key to exit")
|
|
98
|
+
if when_key_pressed_any():
|
|
99
|
+
stop_all()
|
|
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
|
|
@@ -20,72 +20,77 @@ Dynamic: license-file
|
|
|
20
20
|
# Installation
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
|
|
24
23
|
pip install scratch_syntax
|
|
25
|
-
|
|
26
24
|
```
|
|
27
25
|
|
|
28
26
|
you can do anything with this library, mod it, break it, anything, but don't sue me
|
|
29
27
|
|
|
30
28
|
## Update 0.2.0 notes
|
|
31
29
|
|
|
32
|
-
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
|
|
33
31
|
|
|
34
32
|
# Updating
|
|
35
33
|
|
|
36
34
|
```bash
|
|
37
|
-
|
|
38
35
|
pip install --upgrade scratch_syntax
|
|
39
|
-
|
|
40
36
|
```
|
|
41
37
|
|
|
42
38
|
## Update 0.3.0 notes
|
|
43
|
-
* I added the list functions
|
|
44
|
-
|
|
45
39
|
|
|
40
|
+
- I added the list functions
|
|
46
41
|
|
|
47
42
|
## Update 0.4.0 notes
|
|
48
43
|
|
|
49
|
-
|
|
44
|
+
- Added new say_for_seconds() function
|
|
50
45
|
|
|
51
|
-
|
|
46
|
+
- I also added Github Respitory
|
|
52
47
|
|
|
53
48
|
## Update 0.5.0
|
|
54
|
-
* Added new wait_until() function
|
|
55
49
|
|
|
50
|
+
- Added new `wait_until()` function
|
|
56
51
|
|
|
57
|
-
## Update 0.6.0
|
|
58
|
-
* The return of classic repeats... in a different way!!!
|
|
59
|
-
* Added new repeat_until() function!!!
|
|
60
|
-
* Now needs the lambda function. etc:
|
|
61
|
-
```bash
|
|
52
|
+
## Update 0.6.0\. ReRun's UPDATE!!!
|
|
62
53
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
- The return of classic repeats... in a different way!!!
|
|
55
|
+
- Added new repeat_until() function!!!
|
|
56
|
+
- Now needs the lambda function. etc:
|
|
66
57
|
|
|
67
|
-
|
|
58
|
+
```python
|
|
59
|
+
repeat(lambda: say("hello!"), 5)
|
|
60
|
+
forever(lambda: say("hiya!"))
|
|
61
|
+
repeat_until(lambda: say("do you like this?"), lambda: condition())
|
|
62
|
+
```
|
|
68
63
|
|
|
69
|
-
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
|
|
70
65
|
|
|
71
66
|
## Update 0.7.0 notes. Keyboard update!!!
|
|
72
|
-
|
|
67
|
+
|
|
68
|
+
- Added keyboard function `when_key_pressed()`!!!
|
|
73
69
|
|
|
74
70
|
## Update 0.7.2 note:
|
|
75
|
-
|
|
71
|
+
|
|
72
|
+
- I changed the wait_until function a bit so now it goes `wait_until(condition)` instead of `wait_until(action, condition)`
|
|
76
73
|
|
|
77
74
|
## Update 0.7.3:
|
|
78
|
-
* Made the ```when_key_pressed()``` and ```wait_until()``` functions faster
|
|
79
75
|
|
|
76
|
+
- Made the `when_key_pressed()` and `wait_until()` functions faster
|
|
80
77
|
|
|
81
|
-
|
|
82
|
-
# All Functions
|
|
78
|
+
## UPDATE 0.7.4: minor fixes
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
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
|
|
85
|
+
|
|
86
|
+
## All Functions
|
|
86
87
|
|
|
88
|
+
```bash
|
|
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()
|
|
87
90
|
```
|
|
91
|
+
|
|
88
92
|
Also heres an example code
|
|
93
|
+
|
|
89
94
|
```python
|
|
90
95
|
from scratch_syntax import *
|
|
91
96
|
|
|
@@ -94,15 +99,17 @@ ask("hmm what do you think? answer yes please ")
|
|
|
94
99
|
wait_until(answer() == "yes")
|
|
95
100
|
say("hahaha no way you said it!!!")
|
|
96
101
|
repeat_until(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
lambda: (
|
|
103
|
+
say_for_seconds("hello guys!", 1),
|
|
104
|
+
ask("stop running?"),
|
|
105
|
+
),
|
|
106
|
+
lambda: answer() == "yes",
|
|
102
107
|
)
|
|
103
108
|
say("done!")
|
|
104
109
|
say("now it is time for us to part!")
|
|
105
110
|
repeat_until(lambda: ask("would you like to leave?"), lambda: answer() == "yes")
|
|
106
111
|
wait(1)
|
|
107
|
-
|
|
112
|
+
say("press any key to exit")
|
|
113
|
+
if when_key_pressed_any():
|
|
114
|
+
stop_all()
|
|
108
115
|
```
|
scratch_syntax-0.7.3/README.md
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
# Scratch_Syntax
|
|
2
|
-
|
|
3
|
-
## This is a custom Python library designed to make python syntax more like scratch.
|
|
4
|
-
|
|
5
|
-
# Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
|
|
9
|
-
pip install scratch_syntax
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
you can do anything with this library, mod it, break it, anything, but don't sue me
|
|
14
|
-
|
|
15
|
-
## Update 0.2.0 notes
|
|
16
|
-
|
|
17
|
-
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
|
|
18
|
-
|
|
19
|
-
# Updating
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
|
|
23
|
-
pip install --upgrade scratch_syntax
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Update 0.3.0 notes
|
|
28
|
-
* I added the list functions
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
## Update 0.4.0 notes
|
|
33
|
-
|
|
34
|
-
### Added new say_for_seconds() function
|
|
35
|
-
|
|
36
|
-
* I also added Github Respitory
|
|
37
|
-
|
|
38
|
-
## Update 0.5.0
|
|
39
|
-
* Added new wait_until() function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
## Update 0.6.0. ReRun's UPDATE!!!
|
|
43
|
-
* The return of classic repeats... in a different way!!!
|
|
44
|
-
* Added new repeat_until() function!!!
|
|
45
|
-
* Now needs the lambda function. etc:
|
|
46
|
-
```bash
|
|
47
|
-
|
|
48
|
-
repeat(lambda: say("hello!"), 5)
|
|
49
|
-
forever(lambda: say("hiya!"))
|
|
50
|
-
repeat_until(lambda: say("do you like this?"), lambda: condition())
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Also btw don't forget to put from scratch_syntax import * so the functions run correctly as is
|
|
55
|
-
|
|
56
|
-
## Update 0.7.0 notes. Keyboard update!!!
|
|
57
|
-
* Added keyboard function (when_key_pressed())!!!
|
|
58
|
-
|
|
59
|
-
## Update 0.7.2 note:
|
|
60
|
-
* I changed the wait_until function a bit so now it goes ```wait_until(condition) ``` instead of ```wait_until(action, condition)```
|
|
61
|
-
|
|
62
|
-
## Update 0.7.3:
|
|
63
|
-
* Made the ```when_key_pressed()``` and ```wait_until()``` functions faster
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
# All Functions
|
|
68
|
-
|
|
69
|
-
```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()
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
Also heres an example code
|
|
74
|
-
```python
|
|
75
|
-
from scratch_syntax import *
|
|
76
|
-
|
|
77
|
-
say("welcome to this beautiful thing!")
|
|
78
|
-
ask("hmm what do you think? answer yes please ")
|
|
79
|
-
wait_until(answer() == "yes")
|
|
80
|
-
say("hahaha no way you said it!!!")
|
|
81
|
-
repeat_until(
|
|
82
|
-
lambda: (
|
|
83
|
-
say_for_seconds("hello guys!", 1),
|
|
84
|
-
ask("stop running?"),
|
|
85
|
-
),
|
|
86
|
-
lambda: answer() == "yes",
|
|
87
|
-
)
|
|
88
|
-
say("done!")
|
|
89
|
-
say("now it is time for us to part!")
|
|
90
|
-
repeat_until(lambda: ask("would you like to leave?"), lambda: answer() == "yes")
|
|
91
|
-
wait(1)
|
|
92
|
-
stop_all()
|
|
93
|
-
```
|
|
@@ -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.3 → scratch_syntax-0.8.0}/src/scratch_syntax.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|