How to write a GUI in sage
As part of a university project I plan on taking some code I've written in sage and implementing it as a GUI. I've installed sage -i wxPython but now when trying to run import wx from sage I get "No module named wx". Please help!
AFAIK there is no officially supported way to install the wx library or wxPython in the Sage environment. You could do it, of course, but you'd have to do so manually. I think a better bet would be to use a GUI toolkit supplied by your system and use it to wrap Sage (but that depends on what exactly you're trying to do and how).
First of all thank you very much for your comment! And apologies for my lack of technical knowledge in programming. With regards to using a GUI toolkit what would you suggest or how would I access it? I'm using a virtual box to run sage, the code I've written is in sage but uses a package "libbraiding". The hope is I can turn my code into a 'pop out' GUI window and allow the user to change variables ect. Like using wxPython or Tkiner can.
Have you tried to use Tkinter? If it is not installed, you should be able to install it easily.
Hello, thanks for the suggestion. I've tried to install Tkinter by typing both 'sage -i Tkinter' and 'sage -pip install Tkinter' into the Linux terminal however it returns a package not found error :(
Take a look at the "Tcl/Tk" subsection of the "Additional software" section of the installation guide. This should help you. http://doc.sagemath.org/html/en/insta...
@joaoff Tkinter is not easy to install. If it didn't come compiled with the Python distribution it is not easy to otherwise install. It does not necessarily come with Sage by default, though a system version can easily be installed.
@RootUser you talked about using VirtualBox to run Sage? What do you mean by that exactly? Regardless if you want to develop a native GUI (as opposed to something web-based) I would recommend using a GUI toolkit provided by your system (e.g. installing the native wxWidgets for your OS) and wrapping Sage as though it were a black box. I.e. don't worry about running your GUI code with the same Python that is used to run Sage.