2

I would like to use a Jupyter notebook to administer math tests to my high school students on there ipads, I would start a server for each student and have them connect to there own server on there ipads where they would find there own notebook test. I have written the test using widgets and it works great, but i would like to make sure they could not do anything with this notebook except take the test. I have two ideas that I have not been able to get working.

Idea 1: hide the menu bar and all the buttons from the toolbar and add one button that will run the only cell in the book that would have "%run exam.py" that would start the test. With this setup a student could not do extra coding because on the ipad they couldn't use Shift+Enter to start a new cell.

My problem is that I have not been able to find a way to hide the menu bar or hide specific buttons from the tool bar.

Idea 2: In custom.js I noticed that you can run python code with "IPython.notebook.kernel.execute('code here')". So I was hopeing on loading the notebook the custom.js would hide the header and then run my exam code automatically.

I can't seem to get any ipython code to run at loading time, I don't even know if this is possible?

I don't know javascript so my attempts have been fumbling around with the examples in the custom.js to no avail.

Is either idea possible and/or is there a better way to use a notebook to administer an exam?

1 Answer 1

1

1) You probably want to read this about mass deploying IPython for student.

2) If you are not using IPython notebook to run code, then you are probably bending a tool beyond its usage, and a Flask app might be better suited.

3) You need to wrap the call to execute code to execute only once the kernel is started. IF you control the server why not put things in .ipython/profile_default/startup ? Otherwise use the following (might depends on exact version you use):

require(['base/js/events','base/js/namespace'], function(events, IPython){
    events.on('kernel_ready.Kernel', function () {
        // your code here
    })
});

But in general it seem you are miss-using the tools.

Sign up to request clarification or add additional context in comments.

3 Comments

i agree that this is using the notebook for something it was not indented, but it was so easy to write the exam in ipython so that i only had to write each type of question once and it would be slightly different for each student, and each time i use it on a test.
I think you are missing a ")' on your answer. I actually had to use "IPython.notebook.execute_cell()" in the js function to get my code to run the widgets correctly. thanks for your help.
Yes I understand the time pressure. Fixed the bracket. I think your use case to generate an exam/student is interesting for projects like nbgrader.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.