feat(boards): python_mixpy下更新Turtle模块

增加screen.update、turtle.title和turtle.setup接口对应图形块
This commit is contained in:
王立帮
2026-01-04 04:08:41 +08:00
parent c4abb15ba7
commit 7d0a87fc09
6 changed files with 108 additions and 6 deletions

View File

@@ -437,6 +437,38 @@ export const turtle_bgcolor = {
}
};
export const turtle_title = {
init: function () {
this.setColour(TURTLE_HUE);
this.appendValueInput('TITLE')
.setCheck(null)
.setAlign(Blockly.inputs.Align.RIGHT)
.appendField(Blockly.Msg.MIXLY_TURTLE_TITLE_SET);
this.setInputsInline(true);
this.setPreviousStatement(true);
this.setNextStatement(true);
}
};
export const turtle_setup = {
init: function () {
this.setColour(TURTLE_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_TURTLE_SETUP_SET);
this.appendValueInput('WIDTH')
.setCheck(null)
.setAlign(Blockly.inputs.Align.RIGHT)
.appendField(Blockly.Msg.MIXLY_WIDTH);
this.appendValueInput('HEIGHT')
.setCheck(null)
.setAlign(Blockly.inputs.Align.RIGHT)
.appendField(Blockly.Msg.MIXLY_HEIGHT);
this.setInputsInline(true);
this.setPreviousStatement(true);
this.setNextStatement(true);
}
};
export const turtle_tracer = {
init: function () {
this.setColour(TURTLE_HUE);
@@ -825,6 +857,19 @@ export const turtle_getscreen = {
}
export const turtle_update = {
init: function () {
this.setColour(TURTLE_HUE);
this.appendValueInput('TUR');
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_TURTLE_UPDATE);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setInputsInline(true);
this.setTooltip(Blockly.Msg.MIXLY_TURTEL_EVENT_ONKEY_TOOLTIP);
}
};
export const turtle_onkey = {
init: function () {
this.setColour(TURTLE_HUE);