First time here? Check out the FAQ!

Ask Your Question
1

can I use @interact also with the command line?

asked 3 years ago

dantetante gravatar image

updated 3 years ago

I understand that @interact is to be used inside of Jupyter. But since I like the command line much more, I'd like to know if there are ways to use it from a) the SageMath Console in Windows and b) Terminal on Mac OS X also.

Preview: (hide)

Comments

Not sure whether nbterm could help with that, but maybe worth a look.

slelievre gravatar imageslelievre ( 3 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 3 years ago

Emmanuel Charpentier gravatar image

Short (unusable) answer : no.

Better answer : @interact wraps your function in an interact call ; interact ... interacts (surprise !) with an underlying notebook infrastructure running your interface when this infrastructure exists !. If you are running from the command line, this infrastructure does not exists, and interact has nothing to interact with.

In fact, typing interact? in a notebook cell gets you the documentation of the Interact class,which is the infrastructure needed for such interactions. But in a command line session :

sage: interact?
Object `interact` not found.

the interact function isn't even defined then.

Without looking at the source code, one can guess that the Interact class and its companions are defined at session startup ... if and only if the needed infrastructure exists in the session.

HTH,

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 3 years ago

Seen: 321 times

Last updated: Jan 23 '22