How to write a GUI in sage

asked 2018-11-02 10:04:09 -0600

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!

edit retag flag offensive close merge delete

Comments

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).

Iguananaut gravatar imageIguananaut ( 2018-11-02 12:35:00 -0600 )edit

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.

RootUser gravatar imageRootUser ( 2018-11-02 13:04:16 -0600 )edit

Have you tried to use Tkinter? If it is not installed, you should be able to install it easily.

joaoff gravatar imagejoaoff ( 2018-11-02 19:13:25 -0600 )edit

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 :(

RootUser gravatar imageRootUser ( 2018-11-03 07:58:02 -0600 )edit

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 gravatar imagejoaoff ( 2018-11-03 09:38:03 -0600 )edit