Is there a Python interpreter plugin

192 views
Skip to first unread message

Craig Barnes

unread,
Jan 25, 2016, 6:13:11 PM1/25/16
to TiddlyWiki
Hi All,

I am working with primary school teachers to help them get to grips with the new computing curriculum, and am considering tiddlywiki as a basis for a classroom resource to support their curriculum objectives.

I plan to start with HTML CSS and Javascript type resources and exercises, but am also interested in adding a plugin to embed a python interpreter with a shell, syntax highlighting, editor and generated output.

There are a number of javascript implementations of Python, Skulpt looking like a good choice at this point.

My question is, has anyone done anything like this yet?
If not, could someone point me to a good starting point to get me on the right path?

Thank you

BJ

unread,
Jan 29, 2016, 2:59:05 AM1/29/16
to TiddlyWiki
HI Craig,
sounds like a good idea. I don't think there is any python-in-the-browser plugin. I myself am working  on a system for learning programming base upon the idea of jsfiddle within a tiddlywiki, and am using it to learn ractive.js. I would like to learn some python. 

I will take a look to see how easy it is to make a Skulpt pluign

all the best
BJ

BJ

unread,
Feb 2, 2016, 4:28:11 AM2/2/16
to TiddlyWiki
I have make a proof of concept, see it here:

http://pythonplayground.tiddlyspot.com/

Jed Carty

unread,
Feb 2, 2016, 6:41:42 AM2/2/16
to TiddlyWiki
I haven't had time to do more than glance at it, but this great.

Craig Barnes

unread,
Feb 2, 2016, 7:14:02 AM2/2/16
to TiddlyWiki
Hi BJ,

Awesome stuff.  Will take a good look at it this evening :-)

Thank you.

Craig Barnes

unread,
Feb 3, 2016, 8:14:22 AM2/3/16
to tiddl...@googlegroups.com
Hi BJ,

Would you mind giving a high level description of how you achieved this?

I am new to TiddlyWiki and would like to contribute to this.


Thanks

Craig

BJ

unread,
Feb 4, 2016, 4:37:59 AM2/4/16
to tiddl...@googlegroups.com

Here I am using a number of plugins that I am developping for tiddlywiki.

The running of the python code is in a tiddler (project pythontest) with base type 'text/html'. Tiddlers of this type are displayed in an iframe, and must contain html markup as source. The full type of the tiddler is 'text/html;flexibility=tw5flexbox' the 'flexibility' is used by my flexiblity plugin. There is a tiddler 'tw5flexbox' that contains rules that tell (in this case) the plugin to take the source of the tiddler, treat it as type 'text.vnd.tiddlywiki' then use the result as type "text/hmtl". The "treat it as type 'text.vnd.tiddlywiki'" in this case means to use templates to construct a html page from tiddlers - here I use a system similar to the build-in save mechanism of tiddlywiki (when you press the save button a new version your tiddlywiki as html is constructed from its tiddlers.) in the content of the tiddler there is the macro <<make_python pythontest>> which takes all the tiddlers tagged "pythontest" and builds a webpage from them.

The editing and running of the python code (in tidder "project pythontest"). uses my jtinker plugin, that use another of my plugins "mosaic", these provide the drag and drop grid and the ability to have different templates used in the grid (one for editing tiddlers the other to show a tiddler).

I also used my taglist plugin, which shows all tiddlers with the tag "pythontest" as a horizontal list. The order of this list affect the order of insertion of tiddlers into the html . The order of this list can be changed by drag and drop.

I have only release the taglist and flexibilty plugs, the others will be released in the future (once I am happy with them), and so I have hidden the plugins in the demo to stop the effective release of theses plugins by publishing the demo.

Reply all
Reply to author
Forward
0 new messages