Blockly is an open-source web-based, graphical programming environment that enables users to write JavaScript, Python, PHP, and Dart programs by moving around blocks. Developers can extend it to integrate with their own apps. It has been translated into over 40 (human) languages.
Questions tagged [blockly]
197 questions
1
vote
1 answer
What's the event of blockly structure change?
I have a web app that include blockly and I want to be able to save the structure user created on blockly on backend db.
I just want to know how to get the current workspace structure so I can post it to server to save it.
and then load it again…

Ahmed Shehab
- 13
- 4
1
vote
0 answers
add image for dropdown in blockly
I am developing blockly and I need a dropdown which use image instead of text. My code is like this.
Blockly.Blocks['image_dropdown_test']={
init: function(){
var options = [
[{'src': 'canada.svg', 'width': 50, 'height': 25,…

ZhangJoker
- 11
- 2
1
vote
1 answer
How can I inject and read Blockly variables programatically?
I'm discovering Blockly as a useful tool to allow advanced users to "code without coding" some business logic rules, while also sandboxing their access. A classic visual rules engine.
I've seen that Blockly obviously supports variables which I…

Mr. Boy
- 60,845
- 93
- 320
- 589
1
vote
1 answer
Get Google Blockly Block by Id?
I would like to query the DOM to get a block by ID. Currently I have to find all elements by class name, and manually extract the correct index, which is not sustainable.
How can give a block a unique ID?
Thanks

Dazzle
- 2,880
- 3
- 25
- 52
1
vote
1 answer
Blockly Example of Multiple Workspaces
I'm attempting to create a platform that allows students to play code challenges head-to-head using blockly. I'm imagining something like:
The documentation mentions "Multiple workspaces" with block factory, but I feel like I might be reinventing…

Luke Schlangen
- 3,722
- 4
- 34
- 69
1
vote
1 answer
how to generate the javascript code in blockly
I want to generate javascript for my blockly which does not have any input. I got the Javascript function from generator stub but it requires to assemble a javascript code into var code variable which I am not geting.
i already tried this:
var code…

Dev
- 11
- 3
1
vote
2 answers
Initialize a Blockly Mutator within JavaScript
Hi,
as far as I know, custom blocks in Blockly can be defined wether in JSON or in JavaScript, but how can a mutator be initialized in JavaScript?
with JSON:
Blockly.defineBlocksWithJSONArray([
{....
"mutator": "myMutatorName"
});
Then the…

user8626139
- 11
- 1
- 2
1
vote
1 answer
Google Blockly - Append toolbox to a separate div
I've been trying out Blocky to develop a simple animation based application and faced this issue. As mentioned in the docs, I create the xml tree structure of my toolbox, then when I create a new instance of Blockly, it will append the toolbox to…

Nimeshka Srimal
- 8,012
- 5
- 42
- 57
1
vote
1 answer
Uncaught Error: container is not in current document
use blocky in React.js ,the question about the Blockly.inject
import React from 'react'
import Blockly from 'node-blockly'
const toolbox = `
…

Custer
- 145
- 2
- 8
1
vote
1 answer
Javascript, how to save Blockly-generated Python code to a .py file?
I've got a linux machine with a web server, and I use google BLockly to generate python code. It generates it correctly, and I use alert(code) to show the code. How can I save it into a file located in the same web server?
function showCode() {
//…

Davide Pacchiarotti
- 35
- 3
1
vote
1 answer
Image in png/base64 in svg not displaying in Safari
I embedded an image in svg and tried to plot it in Safari. While it works fine in Firefox, the image doesn't display in Safari. The code is simple and displayed below.
Now the weird thing is that when I put this code in an online test site…

user3047221
- 169
- 1
- 7
1
vote
1 answer
Cannot read property call of undefined at Blockly.Generator.blockToCode
I am trying to add a custom text block. But when i enter any text in the input field, the error comes up.
"Uncaught TypeError: Cannot read property 'call' of undefined"
Blockly.Blocks['text_input']={
init:function()
{
this.appendDummyInput()
…

Priya
- 13
- 5
1
vote
1 answer
How can I dynamically generate content of a Blockly dropdown menu?
I am writing an application using python and flask.
In the webinterface, the user is able to make small customized programs using blockly.
Some of the already existing blocks have a dropdown menu.
All that works fine.
But now I want to have a block…

Erpelstolz
- 11
- 1
- 3
1
vote
0 answers
Angular variables with Blockly
I have Blockly blocks with text input
In my starter block, I want to set the text input to an angular variable.
But right now, it says my variable is {{var}} and it evaluates to output.
What currently happens is, the block initially shows output…

Chang
- 11
- 3
1
vote
1 answer
Nesting custom Blockly blocks into loops and generating the code
I am new to blockly and I am playing arround with creating custom blocks.
I've created a new file (move.js) in the blocks folder and there I created some custom blocks. All of them have similar structure, like the one…

Giannis
- 11
- 2