How to write a GUI in sage

asked 2018-11-02 16:04:09 +0200

RootUser gravatar image

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


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 18:35:00 +0200 )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 19:04:16 +0200 )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-03 01:13:25 +0200 )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 13:58:02 +0200 )edit

Take a look at the "Tcl/Tk" subsection of the "Additional software" section of the installation guide. This should help you.

joaoff gravatar imagejoaoff ( 2018-11-03 15:38:03 +0200 )edit