Using Sage Math library within Python
Question: I am trying to make a visualization of a graph using Sage. I need to make the
visualization exactly as I am writing the Python code.

I have downloaded and installed the Sage for Ubuntu and Sage Notebook is
working perfectly. But I want to take user input from Tkinter and then show
those input on the Graph (generated by Sage). However, I am unable to import
sage in the Python Shell. How can I do so?


Answer: From looking at the [faq](http://www.sagemath.org/doc/faq/faq-usage.html#how-
do-i-import-sage-into-a-python-script), it looks like what you need to do is
add the following line to your Python file:

    
    
    from sage.all import *
    

Then, it looks like you need to run your script by using the Python
interpreter bundled with Sage from the command line/console:

    
    
    sage -python /path/to/my/script.py
    

However, if you want to use Sage directly from the shell, you should probably
try using the [interactive
shell](http://www.sagemath.org/doc/tutorial/interactive_shell.html). (just
type in `sage` or maybe `sage -python` from the command line)

Caveat: I haven't tested any of this myself, so you might need to do a bit of
experimenting to get everything to work.

