Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Scratch to Python using Snap! 4.0
- CurtisW
-
Scratcher
49 posts
Scratch to Python using Snap! 4.0
If anyone hasn't tried Snap! 4.0, I think it is really great.
It's almost like upgraded Scratch, and you can do many more things like… Scratch to Python!
If you go to http://snap.berkeley.edu/snapsource/snap.html and open the Example file called Codification, you can create a simple program in Snap! and drag and drop the script into the variable ‘script’. Then run this block and your variable will be set to whatever you drag-dropped.
At the bottom there is a block called ‘Map to python’ with some other blocks attached, and you can run that block and it will convert your scratch to Python! You can see the results in the Stage and export the ‘Code’ variable and run it on python!
Very neat.
It's almost like upgraded Scratch, and you can do many more things like… Scratch to Python!
If you go to http://snap.berkeley.edu/snapsource/snap.html and open the Example file called Codification, you can create a simple program in Snap! and drag and drop the script into the variable ‘script’. Then run this block and your variable will be set to whatever you drag-dropped.
At the bottom there is a block called ‘Map to python’ with some other blocks attached, and you can run that block and it will convert your scratch to Python! You can see the results in the Stage and export the ‘Code’ variable and run it on python!
Very neat.
- The_Grits
-
Scratcher
1000+ posts
Scratch to Python using Snap! 4.0
Sounds cool! I haven't used it, but I might in the future! (I knew that Snap! existed, I just didn't know that it had the Scratch to Python feature.)
- __init__
-
Scratcher
1000+ posts
Scratch to Python using Snap! 4.0
Sounds pretty neat! I'll test it out.
- Starkader
-
New Scratcher
1 post
Scratch to Python using Snap! 4.0
I cant get snap for my operating system(linux)
- liam48D
-
Scratcher
1000+ posts
Scratch to Python using Snap! 4.0
I cant get snap for my operating system(linux)What web browser are you using? Please click on the globe button in the reply box. It'll say something like “My browser / operating system: MacOS Macintosh X 10.5.0, Chrome 17, Flash 11.0 (release 0).”
It's an online program, by the way. Click here to run it.
- ChocolatePi
-
Scratcher
1000+ posts
Scratch to Python using Snap! 4.0
I cant get snap for my operating system(linux)I'd just like to interject for a moment. What you're referring to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.
Many computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called “Linux”, and many of its users are not aware that it is basically the GNU system, developed by the GNU Project.
There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine's resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the GNU operating system: the whole system is basically GNU with Linux added, or GNU/Linux. All the so-called “Linux” distributions are really distributions of GNU/Linux.
- Jonathan50
-
Scratcher
1000+ posts
Scratch to Python using Snap! 4.0
Read the post. It explains how.CurtisW Wrote:How do you do the scratch to python thing?
f anyone hasn't tried Snap! 4.0, I think it is really great.
It's almost like upgraded Scratch, and you can do many more things like… Scratch to Python!
If you go to http://snap.berkeley.edu/snapsource/snap.html and open the Example file called Codification, you can create a simple program in Snap! and drag and drop the script into the variable ‘script’. Then run this block and your variable will be set to whatever you drag-dropped.
At the bottom there is a block called ‘Map to python’ with some other blocks attached, and you can run that block and it will convert your scratch to Python! You can see the results in the Stage and export the ‘Code’ variable and run it on python!
Very neat.
- edmond301
-
Scratcher
5 posts
Scratch to Python using Snap! 4.0
Oh! Thank you! That might be helpful in the future…


- Bryan007
-
Scratcher
100+ posts
Scratch to Python using Snap! 4.0
I can't get snap for my operating system(Linux)Browser Requirements
Browser Minimum
Version
Required Additional Notes
Chrome 43 Chrome is currently the recommended browser for Snap!
Safari 8.4
Firefox 38
Edge 12
Opera 32
IE 11
might be the browser problem
here is my browser version
My browser / operating system: Windows NT 10.0, Chrome 52.0.2743.116, Flash 22.0 (release 0)
- Bryan007
-
Scratcher
100+ posts
Scratch to Python using Snap! 4.0
Last edited by Bryan007 (Aug. 20, 2016 19:12:10)
- HaloLegoFan
-
Scratcher
20 posts
Scratch to Python using Snap! 4.0
I tried it and i can't find out how to do it pls make a video on how to do it pls.
- ArchMan155
-
Scratcher
7 posts
Scratch to Python using Snap! 4.0
Where is the scratch to python button
- card100
-
Scratcher
1000+ posts
Scratch to Python using Snap! 4.0
Where is the scratch to python buttonLook in the top menus
- MCShazam
-
New Scratcher
1 post
Scratch to Python using Snap! 4.0
Ok - so I checked this out - you should know:
1) the Scratch to Python, Scratch to C, etc. are pretty limited converters. They are are only built to convert blocks that operate on numbers and operations. Anything involving sound or graphics is beyond it's capability.
2) it is not button to convert - you need to open the file “Codification” from the examples menu, then read the comments in the scripts to figure out how to do a conversion, basically this:
* Find the block that says set script to { }
* stick your code inside the grey { }
* run this block (by double clicking)
* run the block that starts with Map to Python (or Map to C etc)
It will then show the equivalent code in the display window. As mentioned - anything involving graphics or sound or sensors etc won't work, just calculations.
1) the Scratch to Python, Scratch to C, etc. are pretty limited converters. They are are only built to convert blocks that operate on numbers and operations. Anything involving sound or graphics is beyond it's capability.
2) it is not button to convert - you need to open the file “Codification” from the examples menu, then read the comments in the scripts to figure out how to do a conversion, basically this:
* Find the block that says set script to { }
* stick your code inside the grey { }
* run this block (by double clicking)
* run the block that starts with Map to Python (or Map to C etc)
It will then show the equivalent code in the display window. As mentioned - anything involving graphics or sound or sensors etc won't work, just calculations.
- winshare
-
Scratcher
2 posts
Scratch to Python using Snap! 4.0
my_var = 10
a = True
b = False
my_int = 7
my_int = 3
print (my_int)
spam = True
eggs = False
mysterious_variable = 42
#hweoto3rhq3ph
“”“”skngknthuthotohot
trsjsdjyjsjdh 6ehyj ytysr“”"
count_to = 5
addition = 5 + 0
subtraction = 10 - 5
print (count_to)
eggs = 28
print (eggs)
eggs = 2**8
print (eggs)
eggs = 6 ** 3 - 116
print (eggs)
spam = 4 % 3
print spam
a = True
b = False
my_int = 7
my_int = 3
print (my_int)
spam = True
eggs = False
mysterious_variable = 42
#hweoto3rhq3ph
“”“”skngknthuthotohot
trsjsdjyjsjdh 6ehyj ytysr“”"
count_to = 5
addition = 5 + 0
subtraction = 10 - 5
print (count_to)
eggs = 28
print (eggs)
eggs = 2**8
print (eggs)
eggs = 6 ** 3 - 116
print (eggs)
spam = 4 % 3
print spam
- winshare
-
Scratcher
2 posts
Scratch to Python using Snap! 4.0
people who want to learn python can go to sololearn or codecademy. 

- cooldud2
-
Scratcher
18 posts
Scratch to Python using Snap! 4.0
I tried it but… it was very limited. 


The sound thing didnt even work!




The sound thing didnt even work!

when green flag clicked
say [WHY!] for (2) secs
move (10) steps
turn cw (180) degrees
move (10) steps
turn cw (180) degrees
move (10) steps
point towards [mom v]
play sound [why! v]
set [sadness level v] to [over 9,000]
- Discussion Forums
- » Advanced Topics
-
» Scratch to Python using Snap! 4.0


















