[IPython-dev] [RFC] I want to fix some behaviour. Hints needed

Fernando Perez Fernando.Perez at colorado.edu
Fri Jan 13 00:18:05 CST 2006


Alexander Belchenko wrote:

> Here proposed code for changing title of console window to IPython after 
> editing (probably this code should also be executed and when console 
> IPython started):
> 
> 
> # after editor closed set title of console window to 'IPython'
> if sys.platform == "win32":
>      try:
>          import win32api # part of Mark Hammond's pywin32 package
>          win32api.SetConsoleTitle('IPython')
>      except ImportError:
>          try:
>              import ctypes
>              ctypes.windll.kernel32.SetConsoleTitleA('IPython')
>          except ImportError:
>              pass
> 
> 
> Do you add this code to appropriate place of magic_edit methods or give 
> me the hint where it should be so I'll create the patch? I use IPython 
> only as console application but I hear that IPython also support some 
> sort of GUI mode. In this case proposed code for changing title should 
> not be executed when IPython in GUI mode.
> 
> What you think about?

This is WAY too intrusive and too much of a platform-specific, special-use 
hack to go into ipython proper.  However, the beauty of ipython is that you 
can, trivially, define your own magic function which does precisely this (and 
whatever else you want).

See:

http://ipython.scipy.org/doc/manual/node6.html#SECTION00062000000000000000

for an example of how to customize your own magics.  Just write your own, 
which calls the builtin and at the end, does anything you can possibly want.

The point of ipython is not to be everything to everybody, but to be flexible 
enough that everybody can customize it to fit their needs.

Cheers,

f




More information about the IPython-dev mailing list