Hello!
I have had so much fun with these building blocks of Scratch, that the following come to my mind:
Why not to make the same for my favourite programming language Python?
Would it be possible to represent the code of Python in colourfull visual blocks? Would it be possible to construct Python source using Scratch blocks?
Any ideas about this? Anyone willing to join the team?
Last edited by Snifi (2008-08-13 04:25:15)
Offline
I was thinking to go this way:
The start point is a text-format py-file.
Use the default Python Parser- module routines ( http://docs.python.org/lib/module-parser.html ) to divide it to lexical parts, each part representing one visual block. Here is one implementation of that, in form of Source Code Colorizer: http://code.activestate.com/recipes/442482/
(I think the same should work for this.)
Drawing the blocks using some sources of Scratch. We may build this to work in different environments: OpenGL, wx, GTK, QT, .... What is your favourite?
Later add the drag-and-drop -routines, and construct an "Block Factory" from Python grammar ( http://docs.python.org/ref/grammar.txt )
Adding block means adding a text line (or lexical structure) to py-textfile. Removing block means deleting a line (or structure). This and the earlier would be constructed mainly using regular expressions ( http://www.amk.ca/python/howto/regex/ ). Clicking the "Green Flag" would correspond to just run the py-file.
There could be two different modes in block structures: Beginner mode and Expert mode. Expert-mode block structuring corresponds strictly to Python code, as is, and Beginner mode can remove some Python specific areas from blocks. The first to do is the Expert-mode, because it is similar to Python grammar and easier to implement.
Each block is an object which has textual corresponding, and graphical corresponding, that is methods to print and paint. Painting should be straightforward, so this thing one can go with right away, if someone wants to do this. Here is some advice for painting: http://scratch.mit.edu/forums/viewtopic.php?pid=61805#p61805
(I may still need some experience reading these painting instructions from Scratch-source and what-was-it the blocks building source...)
I'm not quite sure if the main characters here should be sprites or turtles or something else. I myself have some interest towards 3D-modelling, so one possibility is to make it use 3D-objects right from the beginning, e g in Blender or gSculpt, or something similar.
Any thoughts about this?
Oh, and one thing: the name of project: Python Ratz!
Should this be GPL-licenced from early beginning? Open source anyways.
Offline
Ok, well i can draw the blocks for you, but i am unable to program in python.
But i will learn the basics in some other programs!
Give me some commands and i will draw up some blocks.
I am also highly skilled in Web Development! So i can setup a SourceForge site, and i can become Webmaster.
Parragon,
Last edited by parragon (2008-08-17 10:34:20)
Offline
I'd be also interested in .sb exporting to .py
as with py later one can expand app to more complex one
I saw example how to hack into Scratch source
http://scratch.mit.edu/projects/Jens/75626
but I'd need the place where .sb file is loaded (and hopefully parsed or so)
then I could use/hack this area to generate py code.
can anybody direct me for first steps?
----
the platform for multimedia part in py could be http://pyglet.org (some ideas could be borrowed from xturgle and rur-ple.sf.net)
the other ui can be done with wx widgets (as in rur-ple)
seems, it is quite possible to integrate wxPython and pyglet
http://groups.google.com/group/pyglet-users/msg/3a5307e018d5578a
ps.: quite another way -- I was thinking it would'nt be too hard to mimic Scratch visual building blocks functionality with html+javascript
it would be very convenient -- as people don't need to download and install anything.
but then it would probably be javascript based execution/animation -- which still not very good for cross-browsers
Offline
Hi dz0,
please note that the Chirp code which converts Scratch scripts to XML currently only works for Scratch v.1.2.1 projects (and before). If there is interest in this by the community I will update the XML-conversion to the current Scratch version.
Offline
while ur buzy do it for flash 2
. good luck guys!
Offline