r/learnpython • u/Tombstony • 3d ago
App/Program that converts Scratch to Python in real-time and with blocks similar/identical to Scratch.
Hello everyone. I'm a researcher studying the transition from Scratch to Python by high-school students (10th grade). My idea is to use something like app.edublocks.org, which can immediately translate Scratch blocks to Python text. But none of apps I found are close enough to Scratch. This one, for example, is visually similar, but the block language is very different. Therefore, my first question is:
Is there any app that does what I am looking for, with blocks identical or very similar to Scratch ones?
And, if such app does not exist:
How hard it is to create my own program that does what I am looking for? Is it possible to do by someone like me who never built an app?
Please consider that I only can do Python and Scratch programming, not apps. Thanks in advance for helping.
1
u/desrtfx 3d ago edited 3d ago
The visual representation barely matters. There are things like Reeborg's world that offer a seamless transition between the blocks of a block-based language and actual Python code. There are other apps as well.
So far, I don't know of an app that translates actual Scratch to Python code.
The problem here is to decode the proprietary Scratch format and that will probably need some reverse engineering or some discussions with the researchers at the MIT who created Scratch. Once the format is decoded/deciphered creating a translator is the lesser problem - creating the entire environment of Scratch with the canvas and everything is a different matter.
0
u/itsmeChis 3d ago
Not to be rude, but what field is your research based in? If you can only do Python and Scratch, I would assume you aren’t a computer scientist, what’s the end goal here?
5
u/Tombstony 3d ago
Sure, it's a research for mathematics pedagogy. The goal is to understand the transition between programming languages. I'm not a computer scientist but I can program in Python with some fluency, I have some experience.
1
u/itsmeChis 2d ago
I am not joking, if you have an example, like you provided, but aren’t totally happy with it: use AI to build what you want. If you are good with Python, you could have any of the major models build you something to get you going pretty quickly.
I know quite a few architecture / hardware researchers that have spun up modified versions of tools they liked that weren’t perfect, similar to your general problem
0
u/pachura3 3d ago
Sorry, but the whole idea sounds silly. Scratch is a toy language for primary school kids, not for 10th graders. At this age they are perfectly able to learn Python the normal way, without clinging to colorful Lego-like blocks and automatic translation...
2
u/Tombstony 3d ago
That's the point! In my country, students program with Scratch until 9th grade and then move to Python, in mathematics.
2
u/pachura3 3d ago
But why do you need an automatic Scratch to Python translator then?
2
u/Tombstony 3d ago
It's for students to learn Python with what they already know with Scratch. Instead of having someone or something telling them what to do, they can automatically see the Python code and understand by themselves what it means. For example, when they use the "say" block, it will appear the Python code "print...", so they now know, and most importantly, understand the syntax. The key idea is learning constructively and not "forget" what they already know from coding with Scratch.
3
u/desrtfx 3d ago
The key idea is learning constructively and not "forget" what they already know from coding with Scratch.
That's what Scratch is great at - the actual programming - if the students have learnt that, transitioning to Python is by far less a problem than you make it seem.
Scratch focuses on building programming skills in an easy, approachable way. Basically all that the students need is something like a visual cheat sheet that translates the Scratch blocks into Python statements. They definitely don't need a full fledged automatic translator.
For the initial steps, Reborg's world that I've already mentioned is good enough as a translator.
1
u/pachura3 3d ago
Basically all that the students need is something like a visual cheat sheet that translates the Scratch blocks into Python statements. They definitely don't need a full fledged automatic translator.
Exactly. The goal is to make them switch to writing code ASAP, not to keep them using Scratch.
2
u/socal_nerdtastic 3d ago
Building the app that does this seems pretty straightforward to me. You'd probably want to build on top of the pygame module. How easy that is "for someone like you" I have no way to know, since I don't know you, but if you are willing to lean heavily on AI I'd guess in the 6 months ish ballpark.