Creating micro:bit sandbox (restrict available blocks)

Hello!

I am trying to create a slightly restricted version of the micro:bit code editor. The only thing I am really trying to do is to:

  • Restrict the blocks that are available to use
  • Everything else should stay the same

This is mainly to make the editor less confusing for younger learners.

I know how to create tutorials and am aware that I can create something like this with a tutorial but it is a bit of a hack and doesn’t work the way I would like it. For example I cannot hide away the Step controls and the Done button which will drop the user out of the tutorial. The docs mention ### @hideIteration true as an option to do this but it does not work for me in the make:code editor. So as soon as someone exits the tutorial all the blocks are back again.

Is there an easier way to create an editor with a restricted blocks set?

Thanks,
Michael

Hi
.might not be exactly what you want but have you looked at Microcode ?

Regards

could you be a little more specific about what blocks you want to hide?

you can hide all the non built-in categories with an extension. it’s a little hacky but it works! try opening this project:

the extension code looks like this:

//% deprecated=true
namespace music {
}

//% deprecated=true
namespace led {
}

//% deprecated=true
namespace game {
}

//% deprecated=true
namespace images {
}

//% deprecated=true
namespace pins {
}

//% deprecated=true
namespace serial {
}

//% deprecated=true
namespace control {
}

//% deprecated=true
namespace radio {
}

//% deprecated=true
namespace input {
}

//% deprecated=true
namespace basic {
}
1 Like

@mpoelzl i liked your line of thinking here, so i opened a pr to add support for projects/extensions to filter the blocks and categories that show up in the toolbox:

1 Like

Hi Richard,

That is awesome stuff, thanks a lot for the change! I see that it already has been approved and just waiting on a check.

Sorry I don’t know how this normally works but once approved, when would this be available in the beta editor?

Hello!
I can create extensions but to my knowledge it is not possible yet to restrict the available blocks in the toolbox. @richard has just created a PR to add this functionality to the editor which can be controlled from the pxt.json file. I don’t think it is available yet.

ah, sorry, didn’t realize you were waiting on my changes appearing in beta! i’ll push them out to the micro:bit beta site today.

FYI though, we do not recommend people use beta for anything other than testing. the beta editor should be considered unstable!

@richard Fantastic, thank you so much! The functionality is exactly what I need.

I understand about the beta editor, is there a fixed release cycle to bring these changes intot he main version?

@mpoelzl we do releases to the main feed over the summer so as to not disrupt too many teachers during the school year. however, we might be able to release this in a patch release since it’s such a minor change. i’ll bring it up with the team.

if it does go out in a patch release, it will probably be early january because we like to let things sit in beta for a while before pushing them out (and most of the team is out in the second half of december). in the meantime, please do test the feature to make sure it’s working as expected!

1 Like

@richard
Hello!

Just some feedback to let you know that I have been using this feature a lot over the past weeks and is has been working great and is a gamechanger :slight_smile: ! It works really well with younger kids to focus their efforts in the right place. Is there any chance it will be included in the main version of the editor any time soon?

Thanks,
Michael