Processing.py-Bugs
Processing.py-Bugs copied to clipboard
Including input function and some imports from __future__
As I am using processing.py to teach an introductory course to computer science I'd be interested to have an input function:
def input(message=''):
from javax.swing import JOptionPane
return JOptionPane.showInputDialog(frame, message)
from a solution mentioned in an answer to another request.
Additionally I need some imports from future, namely division, print_function and unicode_literals.
For the time being I managed to do that by patching some files in modes/PythonMode.jar.
Would it be possible to add these changes in the officially distributed version of the Python mode?
Regards Tobias
Why can you not use that input function? It works fine for me.
What files did you patch?
Yes, I can use the function above. But for use in a class room I'd like to hide it from the students and have it transparently available.
I patched jycessing/core.py in PythonMode/mode/PythonMode.jar:
-
Added at top of file from future import division, unicode_literals
-
Added at bottom of file: def input(message=''): from javax.swing import JOptionPane return JOptionPane.showInputDialog(frame, message) builtin.input = input
Would it be possible to add something along these lines in the distribution of PythonMode?