GTK pylab console

Hi all,

I've developed a GTK/Python/Pylab console that is able to display
most matplotlib figures directly within the console and handle
matplotlib mouse events properly.

Screenshots and sources are available at:
http://www.loria.fr/~rougier/pylab.html

I've tested several examples from matplotlib examples and they
seem to be displayed properly. Any comments/requests are welcome.

Nicolas Rougier.

What would be really great is if you could insert the toolbar under
the figure so panning and zooming would be enabled.

Also, you mentioned getting lost in the flurry of ipython1 -- you may
want to check back with them in the near future because I think they
are making great strides and a gtk frontend would be excellent.

Finally, I've made a minor additions to support "draw_if_interactive"
so you don't need to call show. Just type "plot" or "xlim" etc and
the plot automagically updates. I also needed to replace partial
since it does not ship with python2.4.

Thanks,
JDH

gpylab (8.59 KB)

···

On Fri, Jun 27, 2008 at 8:03 AM, Nicolas Rougier <Nicolas.Rougier@...466...> wrote:

I've developed a GTK/Python/Pylab console that is able to display
most matplotlib figures directly within the console and handle
matplotlib mouse events properly.

Thanks John, I've update the new version with your code.

It is now available at:
  http://www.loria.fr/~rougier/pylab.html

You can now choose between python and ipython (option -s python
or -s ipython) and all user events on a figure should be handled
properly (mouse, scroll and key).

Concerning the toolbar, is is quite easy to add but it is not
very pleasant to the eyes. I'm looking for a more asethetic solution.

Nicolas

···

On Fri, 2008-06-27 at 09:58 -0500, John Hunter wrote:

On Fri, Jun 27, 2008 at 8:03 AM, Nicolas Rougier > <Nicolas.Rougier@...466...> wrote:

> I've developed a GTK/Python/Pylab console that is able to display
> most matplotlib figures directly within the console and handle
> matplotlib mouse events properly.

What would be really great is if you could insert the toolbar under
the figure so panning and zooming would be enabled.

Also, you mentioned getting lost in the flurry of ipython1 -- you may
want to check back with them in the near future because I think they
are making great strides and a gtk frontend would be excellent.

Finally, I've made a minor additions to support "draw_if_interactive"
so you don't need to call show. Just type "plot" or "xlim" etc and
the plot automagically updates. I also needed to replace partial
since it does not ship with python2.4.

Thanks,
JDH

I've only had a limited chance to test this but it looks very
exciting. I am amazed by how quickly you go the ipython shell
incorporated. I am still a bit vexed by the lack of support for emacs
key bindings (I guess having ipython and readline support are not
enough, but I bet there is some gtk console code out there to support
them). I do miss my CTRL-a and CTRL-k and friends.

As for the toolbar, I think functionality over aesthetics carries the
day because it is easy to make it pretty after you make it work (and
you can always make it optional with a flag), but note that you do not
need to use the standard gtk toolbar widget -- you can write your own
that works however you want. There is only minimal overhead for the
toolbar writer that is fairly well documented in backend_bases.py.
One option is to draw no toolbar at all but just just set up key
bindings (press 'z' to toggle zoom mode, 'r' to toggle draw to rect
mode, etc, or draw your own toolbar or whatever. But having the
functionality is a killer feature, in my opinion.

Keep us posted.

JDH

···

On Sun, Jun 29, 2008 at 9:28 AM, Nicolas Rougier <Nicolas.Rougier@...466...> wrote:

Thanks John, I've update the new version with your code.

It is now available at:
http://www.loria.fr/~rougier/pylab.html

You can now choose between python and ipython (option -s python
or -s ipython) and all user events on a figure should be handled
properly (mouse, scroll and key).

Concerning the toolbar, is is quite easy to add but it is not
very pleasant to the eyes. I'm looking for a more asethetic solution.

Hi,

I've added some basic support for readline shortcuts:

Ctrl-A: start of line
Ctrl-E: end of line
Ctrl-K: kill from cursor to end of line
Ctrl-Y: yank kill buffer
Ctrl-L: clear console

I've also added an option for displaying the toolbar(2).

Usage is now:

pycons [--ipython] [--pylab] [--toolbar]

If the toolbar is not specified, commands can be typed directly within
console: zoom(), pan(), home(), back(), forward(), save()

There is now a installable package (pycons.tgz) available from:

http://www.loria.fr/~rougier/pycons.html

Nicolas

···

On Mon, 2008-06-30 at 21:21 -0500, John Hunter wrote:

On Sun, Jun 29, 2008 at 9:28 AM, Nicolas Rougier > <Nicolas.Rougier@...466...> wrote:
>
>
> Thanks John, I've update the new version with your code.
>
> It is now available at:
> http://www.loria.fr/~rougier/pylab.html
>
> You can now choose between python and ipython (option -s python
> or -s ipython) and all user events on a figure should be handled
> properly (mouse, scroll and key).
>
> Concerning the toolbar, is is quite easy to add but it is not
> very pleasant to the eyes. I'm looking for a more asethetic solution.

I've only had a limited chance to test this but it looks very
exciting. I am amazed by how quickly you go the ipython shell
incorporated. I am still a bit vexed by the lack of support for emacs
key bindings (I guess having ipython and readline support are not
enough, but I bet there is some gtk console code out there to support
them). I do miss my CTRL-a and CTRL-k and friends.

As for the toolbar, I think functionality over aesthetics carries the
day because it is easy to make it pretty after you make it work (and
you can always make it optional with a flag), but note that you do not
need to use the standard gtk toolbar widget -- you can write your own
that works however you want. There is only minimal overhead for the
toolbar writer that is fairly well documented in backend_bases.py.
One option is to draw no toolbar at all but just just set up key
bindings (press 'z' to toggle zoom mode, 'r' to toggle draw to rect
mode, etc, or draw your own toolbar or whatever. But having the
functionality is a killer feature, in my opinion.

Keep us posted.

JDH

Hi Nicolas,

  Your pycons is great!
I has to correct a small issue in the tar.gz from your website before being able to test pycons:
  I had to change:
"import gtk_console.console as cons"
to "import console as cons"
in pycons file around line 12.

After that I can report pycons is running on my MacBook (MacOS 10.5) with python, pygtk... from macports.

Another point:
do you mind releasing your code in a more permissive license that GPL. I mean LGPL or BSD like? I'm interested in including your code in my own LGPL app.

Thanks for this great peace of work.

All the best,

David

Nicolas Rougier a �crit :

···

Hi,

I've added some basic support for readline shortcuts:

Ctrl-A: start of line
Ctrl-E: end of line
Ctrl-K: kill from cursor to end of line
Ctrl-Y: yank kill buffer
Ctrl-L: clear console

I've also added an option for displaying the toolbar(2).

Usage is now:

pycons [--ipython] [--pylab] [--toolbar]

If the toolbar is not specified, commands can be typed directly within
console: zoom(), pan(), home(), back(), forward(), save()

There is now a installable package (pycons.tgz) available from:

http://www.loria.fr/~rougier/pycons.html

Nicolas

On Mon, 2008-06-30 at 21:21 -0500, John Hunter wrote:

On Sun, Jun 29, 2008 at 9:28 AM, Nicolas Rougier >> <Nicolas.Rougier@...466...> wrote:

Thanks John, I've update the new version with your code.

It is now available at:
http://www.loria.fr/~rougier/pylab.html

You can now choose between python and ipython (option -s python
or -s ipython) and all user events on a figure should be handled
properly (mouse, scroll and key).

Concerning the toolbar, is is quite easy to add but it is not
very pleasant to the eyes. I'm looking for a more asethetic solution.

I've only had a limited chance to test this but it looks very
exciting. I am amazed by how quickly you go the ipython shell
incorporated. I am still a bit vexed by the lack of support for emacs
key bindings (I guess having ipython and readline support are not
enough, but I bet there is some gtk console code out there to support
them). I do miss my CTRL-a and CTRL-k and friends.

As for the toolbar, I think functionality over aesthetics carries the
day because it is easy to make it pretty after you make it work (and
you can always make it optional with a flag), but note that you do not
need to use the standard gtk toolbar widget -- you can write your own
that works however you want. There is only minimal overhead for the
toolbar writer that is fairly well documented in backend_bases.py.
One option is to draw no toolbar at all but just just set up key
bindings (press 'z' to toggle zoom mode, 'r' to toggle draw to rect
mode, etc, or draw your own toolbar or whatever. But having the
functionality is a killer feature, in my opinion.

Keep us posted.

JDH

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options

Thanks,

I changed the license to a BSD one, hope this is compatible with
matplotlib. I also changed the module name from 'gtk_console' to pycons
since it makes more sense.

I also tried to remove the gtk_console.console (now this is
pycons.console) in favor of console but it does not work as expected I
would say. In fact, I'm surprised it's working for you. What do you get
from a simple "import pycons" ?

Nicolas

···

On Tue, 2008-07-01 at 14:32 +0200, David Trem wrote:

Hi Nicolas,

  Your pycons is great!
I has to correct a small issue in the tar.gz from your website before
being able to test pycons:
  I had to change:
"import gtk_console.console as cons"
to "import console as cons"
in pycons file around line 12.

After that I can report pycons is running on my MacBook (MacOS 10.5)
with python, pygtk... from macports.

Another point:
do you mind releasing your code in a more permissive license that GPL. I
mean LGPL or BSD like? I'm interested in including your code in my own
LGPL app.

Thanks for this great peace of work.

All the best,

David

Nicolas Rougier a écrit :
>
> Hi,
>
> I've added some basic support for readline shortcuts:
>
> Ctrl-A: start of line
> Ctrl-E: end of line
> Ctrl-K: kill from cursor to end of line
> Ctrl-Y: yank kill buffer
> Ctrl-L: clear console
>
> I've also added an option for displaying the toolbar(2).
>
> Usage is now:
>
> pycons [--ipython] [--pylab] [--toolbar]
>
>
> If the toolbar is not specified, commands can be typed directly within
> console: zoom(), pan(), home(), back(), forward(), save()
>
> There is now a installable package (pycons.tgz) available from:
>
> http://www.loria.fr/~rougier/pycons.html
>
>
>
> Nicolas
>
>
>
> On Mon, 2008-06-30 at 21:21 -0500, John Hunter wrote:
>> On Sun, Jun 29, 2008 at 9:28 AM, Nicolas Rougier > >> <Nicolas.Rougier@...466...> wrote:
>>>
>>> Thanks John, I've update the new version with your code.
>>>
>>> It is now available at:
>>> http://www.loria.fr/~rougier/pylab.html
>>>
>>> You can now choose between python and ipython (option -s python
>>> or -s ipython) and all user events on a figure should be handled
>>> properly (mouse, scroll and key).
>>>
>>> Concerning the toolbar, is is quite easy to add but it is not
>>> very pleasant to the eyes. I'm looking for a more asethetic solution.
>> I've only had a limited chance to test this but it looks very
>> exciting. I am amazed by how quickly you go the ipython shell
>> incorporated. I am still a bit vexed by the lack of support for emacs
>> key bindings (I guess having ipython and readline support are not
>> enough, but I bet there is some gtk console code out there to support
>> them). I do miss my CTRL-a and CTRL-k and friends.
>>
>> As for the toolbar, I think functionality over aesthetics carries the
>> day because it is easy to make it pretty after you make it work (and
>> you can always make it optional with a flag), but note that you do not
>> need to use the standard gtk toolbar widget -- you can write your own
>> that works however you want. There is only minimal overhead for the
>> toolbar writer that is fairly well documented in backend_bases.py.
>> One option is to draw no toolbar at all but just just set up key
>> bindings (press 'z' to toggle zoom mode, 'r' to toggle draw to rect
>> mode, etc, or draw your own toolbar or whatever. But having the
>> functionality is a killer feature, in my opinion.
>>
>> Keep us posted.
>>
>> JDH
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> matplotlib-devel List Signup and Options

Sorry for the trouble, I started testing your "old" pylab wich was provided without the setup script, which led me testing pycons from the pycons folder itself (no setup.py install done).
Pycons was actually working fine.
However, I encounter problem when closing the console with a graph inside and with the >>>help() command which is freezing the windows... But this is basically usable.

Thanks you very much considering my license request!
I don't think there could be license issue with matplotlib since it is also using a quite permissive license. Could the matplotlib gurus comment on that?

Thanks,

David

Nicolas Rougier a écrit :

···

Thanks,

I changed the license to a BSD one, hope this is compatible with
matplotlib. I also changed the module name from 'gtk_console' to pycons
since it makes more sense.

I also tried to remove the gtk_console.console (now this is
pycons.console) in favor of console but it does not work as expected I
would say. In fact, I'm surprised it's working for you. What do you get
from a simple "import pycons" ?

Nicolas

On Tue, 2008-07-01 at 14:32 +0200, David Trem wrote:

Hi Nicolas,

  Your pycons is great!
I has to correct a small issue in the tar.gz from your website before being able to test pycons:
  I had to change:
"import gtk_console.console as cons"
to "import console as cons"
in pycons file around line 12.

After that I can report pycons is running on my MacBook (MacOS 10.5) with python, pygtk... from macports.

Another point:
do you mind releasing your code in a more permissive license that GPL. I mean LGPL or BSD like? I'm interested in including your code in my own LGPL app.

Thanks for this great peace of work.

All the best,

David

Nicolas Rougier a écrit :

Hi,

I've added some basic support for readline shortcuts:

Ctrl-A: start of line
Ctrl-E: end of line
Ctrl-K: kill from cursor to end of line
Ctrl-Y: yank kill buffer
Ctrl-L: clear console

I've also added an option for displaying the toolbar(2).

Usage is now:

pycons [--ipython] [--pylab] [--toolbar]

If the toolbar is not specified, commands can be typed directly within
console: zoom(), pan(), home(), back(), forward(), save()

There is now a installable package (pycons.tgz) available from:

http://www.loria.fr/~rougier/pycons.html

Nicolas

On Mon, 2008-06-30 at 21:21 -0500, John Hunter wrote:

On Sun, Jun 29, 2008 at 9:28 AM, Nicolas Rougier >>>> <Nicolas.Rougier@...466...> wrote:

Thanks John, I've update the new version with your code.

It is now available at:
http://www.loria.fr/~rougier/pylab.html

You can now choose between python and ipython (option -s python
or -s ipython) and all user events on a figure should be handled
properly (mouse, scroll and key).

Concerning the toolbar, is is quite easy to add but it is not
very pleasant to the eyes. I'm looking for a more asethetic solution.

I've only had a limited chance to test this but it looks very
exciting. I am amazed by how quickly you go the ipython shell
incorporated. I am still a bit vexed by the lack of support for emacs
key bindings (I guess having ipython and readline support are not
enough, but I bet there is some gtk console code out there to support
them). I do miss my CTRL-a and CTRL-k and friends.

As for the toolbar, I think functionality over aesthetics carries the
day because it is easy to make it pretty after you make it work (and
you can always make it optional with a flag), but note that you do not
need to use the standard gtk toolbar widget -- you can write your own
that works however you want. There is only minimal overhead for the
toolbar writer that is fairly well documented in backend_bases.py.
One option is to draw no toolbar at all but just just set up key
bindings (press 'z' to toggle zoom mode, 'r' to toggle draw to rect
mode, etc, or draw your own toolbar or whatever. But having the
functionality is a killer feature, in my opinion.

Keep us posted.

JDH

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options

Cool, this is working for me now. Very nice. Two more comments:

You must override draw_if_interactive *before* importing pylab:

    import matplotlib.backends.backend_gtkagg as backend_gtkagg

    def draw_if_interactive():
        """ Is called after every pylab drawing command """
        show(console)
    # do this before importing pylab
    backend_gtkagg.draw_if_interactive = draw_if_interactive
    import pylab
    import matplotlib.pylab
    from matplotlib._pylab_helpers import Gcf

and when I run in --pylab mode, the pylab namespace is not imported.
I have to manually 'from pylab import *' . Is that intentional?

···

On Tue, Jul 1, 2008 at 5:31 AM, Nicolas Rougier <Nicolas.Rougier@...466...> wrote:

There is now a installable package (pycons.tgz) available from:

http://www.loria.fr/~rougier/pycons.html

Yes, the BSD license is compatible with mpl, the GPL one was not.
Thanks for changing it Nicolas.

JDH

···

On Tue, Jul 1, 2008 at 8:37 AM, David Trem <david.trem@...149...> wrote:

Thanks you very much considering my license request!
I don't think there could be license issue with matplotlib since it is
also using a quite permissive license. Could the matplotlib gurus
comment on that?

Beautiful work, and many thanks for the license change too, since it's
now comatible with ipython as well.

BTW, are you on the ipython-dev list? If not, I'd like to encourage
you to join in. Right now we're in the middle of refactoring the
ipython code and we have people working on WX, Qt and Cocoa consoles,
with a proper architecture (backend/frontend separation). I think it
would be great if your GTK one also made it into the same codebase, so
that your console could 'ride' on top of the common layer that all
others will share.

Minor note: you may want to initialize the ipython session with
--colors LightBG since you have a light background, so we get better
readability.

Cheers,

f

···

On Tue, Jul 1, 2008 at 6:01 AM, Nicolas Rougier <Nicolas.Rougier@...466...> wrote:

Thanks,

I changed the license to a BSD one, hope this is compatible with
matplotlib. I also changed the module name from 'gtk_console' to pycons
since it makes more sense.

Thanks, corrected.
I just forgot the pylab import, it has been corrected as well.

Nicolas

···

On Tue, 2008-07-01 at 08:38 -0500, John Hunter wrote:

On Tue, Jul 1, 2008 at 5:31 AM, Nicolas Rougier > <Nicolas.Rougier@...466...> wrote:

> There is now a installable package (pycons.tgz) available from:
>
> http://www.loria.fr/~rougier/pycons.html

Cool, this is working for me now. Very nice. Two more comments:

You must override draw_if_interactive *before* importing pylab:

    import matplotlib.backends.backend_gtkagg as backend_gtkagg

    def draw_if_interactive():
        """ Is called after every pylab drawing command """
        show(console)
    # do this before importing pylab
    backend_gtkagg.draw_if_interactive = draw_if_interactive
    import pylab
    import matplotlib.pylab
    from matplotlib._pylab_helpers import Gcf

and when I run in --pylab mode, the pylab namespace is not imported.
I have to manually 'from pylab import *' . Is that intentional?

The "help()" freeze is not really a freeze since you can type input
within the terminal from where you started pycons. I managed to find
that the IPython import was responsible for this behavior for some
unknown reason. If you remove all reference to IPython in the pycons
file, then you got the expected behavior. Since IPython is under
heavy redesign, I won't investigate further until the next version.

What is the problem when closing with a graph inside ?

Nicolas

···

On Tue, 2008-07-01 at 15:37 +0200, David Trem wrote:

Sorry for the trouble, I started testing your "old" pylab wich was
provided without the setup script, which led me testing pycons from the
pycons folder itself (no setup.py install done).
Pycons was actually working fine.
However, I encounter problem when closing the console with a graph
inside and with the >>>help() command which is freezing the windows...
But this is basically usable.

Thanks you very much considering my license request!
I don't think there could be license issue with matplotlib since it is
also using a quite permissive license. Could the matplotlib gurus
comment on that?

Thanks,

David

Nicolas Rougier a écrit :
>
> Thanks,
>
> I changed the license to a BSD one, hope this is compatible with
> matplotlib. I also changed the module name from 'gtk_console' to pycons
> since it makes more sense.
>
> I also tried to remove the gtk_console.console (now this is
> pycons.console) in favor of console but it does not work as expected I
> would say. In fact, I'm surprised it's working for you. What do you get
> from a simple "import pycons" ?
>
> Nicolas
>
>
> On Tue, 2008-07-01 at 14:32 +0200, David Trem wrote:
>> Hi Nicolas,
>>
>> Your pycons is great!
>> I has to correct a small issue in the tar.gz from your website before
>> being able to test pycons:
>> I had to change:
>> "import gtk_console.console as cons"
>> to "import console as cons"
>> in pycons file around line 12.
>>
>> After that I can report pycons is running on my MacBook (MacOS 10.5)
>> with python, pygtk... from macports.
>>
>> Another point:
>> do you mind releasing your code in a more permissive license that GPL. I
>> mean LGPL or BSD like? I'm interested in including your code in my own
>> LGPL app.
>>
>> Thanks for this great peace of work.
>>
>> All the best,
>>
>> David
>>
>> Nicolas Rougier a écrit :
>>> Hi,
>>>
>>> I've added some basic support for readline shortcuts:
>>>
>>> Ctrl-A: start of line
>>> Ctrl-E: end of line
>>> Ctrl-K: kill from cursor to end of line
>>> Ctrl-Y: yank kill buffer
>>> Ctrl-L: clear console
>>>
>>> I've also added an option for displaying the toolbar(2).
>>>
>>> Usage is now:
>>>
>>> pycons [--ipython] [--pylab] [--toolbar]
>>>
>>>
>>> If the toolbar is not specified, commands can be typed directly within
>>> console: zoom(), pan(), home(), back(), forward(), save()
>>>
>>> There is now a installable package (pycons.tgz) available from:
>>>
>>> http://www.loria.fr/~rougier/pycons.html
>>>
>>>
>>>
>>> Nicolas
>>>
>>>
>>>
>>> On Mon, 2008-06-30 at 21:21 -0500, John Hunter wrote:
>>>> On Sun, Jun 29, 2008 at 9:28 AM, Nicolas Rougier > >>>> <Nicolas.Rougier@...466...> wrote:
>>>>> Thanks John, I've update the new version with your code.
>>>>>
>>>>> It is now available at:
>>>>> http://www.loria.fr/~rougier/pylab.html
>>>>>
>>>>> You can now choose between python and ipython (option -s python
>>>>> or -s ipython) and all user events on a figure should be handled
>>>>> properly (mouse, scroll and key).
>>>>>
>>>>> Concerning the toolbar, is is quite easy to add but it is not
>>>>> very pleasant to the eyes. I'm looking for a more asethetic solution.
>>>> I've only had a limited chance to test this but it looks very
>>>> exciting. I am amazed by how quickly you go the ipython shell
>>>> incorporated. I am still a bit vexed by the lack of support for emacs
>>>> key bindings (I guess having ipython and readline support are not
>>>> enough, but I bet there is some gtk console code out there to support
>>>> them). I do miss my CTRL-a and CTRL-k and friends.
>>>>
>>>> As for the toolbar, I think functionality over aesthetics carries the
>>>> day because it is easy to make it pretty after you make it work (and
>>>> you can always make it optional with a flag), but note that you do not
>>>> need to use the standard gtk toolbar widget -- you can write your own
>>>> that works however you want. There is only minimal overhead for the
>>>> toolbar writer that is fairly well documented in backend_bases.py.
>>>> One option is to draw no toolbar at all but just just set up key
>>>> bindings (press 'z' to toggle zoom mode, 'r' to toggle draw to rect
>>>> mode, etc, or draw your own toolbar or whatever. But having the
>>>> functionality is a killer feature, in my opinion.
>>>>
>>>> Keep us posted.
>>>>
>>>> JDH
>>>
>>> -------------------------------------------------------------------------
>>> Check out the new SourceForge.net Marketplace.
>>> It's the best place to buy or sell services for
>>> just about anything Open Source.
>>> http://sourceforge.net/services/buy/index.php
>>> _______________________________________________
>>> Matplotlib-devel mailing list
>>> Matplotlib-devel@lists.sourceforge.net
>>> matplotlib-devel List Signup and Options
>

I'm not yet on the ipython-dev but I read the archive to check progress
on ipython1 and I get a bit lost with the redesign. The backend/frontend
will definitely help to embed ipython. Where can I get the latest
version (with wx for example) so I can try to code the GTK one ?

Concerning the colors options, I'm not sure where to put it, in the argv
argument ?

Cheers.

Nicolas

···

On Tue, 2008-07-01 at 12:22 -0700, Fernando Perez wrote:

On Tue, Jul 1, 2008 at 6:01 AM, Nicolas Rougier > <Nicolas.Rougier@...466...> wrote:
>
>
> Thanks,
>
> I changed the license to a BSD one, hope this is compatible with
> matplotlib. I also changed the module name from 'gtk_console' to pycons
> since it makes more sense.

Beautiful work, and many thanks for the license change too, since it's
now comatible with ipython as well.

BTW, are you on the ipython-dev list? If not, I'd like to encourage
you to join in. Right now we're in the middle of refactoring the
ipython code and we have people working on WX, Qt and Cocoa consoles,
with a proper architecture (backend/frontend separation). I think it
would be great if your GTK one also made it into the same codebase, so
that your console could 'ride' on top of the common layer that all
others will share.

Minor note: you may want to initialize the ipython session with
--colors LightBG since you have a light background, so we get better
readability.

Cheers,

f

I'm not yet on the ipython-dev but I read the archive to check progress
on ipython1 and I get a bit lost with the redesign. The backend/frontend
will definitely help to embed ipython. Where can I get the latest
version (with wx for example) so I can try to code the GTK one ?

All development for ipython now happens on launchpad, so you can just

bzr branch lp:iptyhon

as indicated here:
http://ipython.scipy.org/moin/Developer_Zone

The various GUI frontends are just being built, so there isn't a
single component to download yet. But feel free to jump on the list
with questions (and show your code!) I'm sure there will be plenty of
interest.

Concerning the colors options, I'm not sure where to put it, in the argv
argument ?

You can do that, but here's a cleaner solution that uses the actual ipython api:

tlon[pycons]> diff -u ishell.py.ori ishell.py
--- ishell.py.ori 2008-07-01 15:25:01.000000000 -0700
+++ ishell.py 2008-07-01 15:33:46.000000000 -0700
@@ -19,6 +19,7 @@
from StringIO import StringIO
try:
     import IPython
+ from IPython import ipapi
except Exception,e:
     raise "Error importing IPython (%s)" % str(e)

@@ -52,6 +53,11 @@
         self.IP.system = lambda cmd: self.shell(self.IP.var_expand(cmd),
                                                 header='IPython system call: ',

verbose=self.IP.rc.system_verbose)

···

On Tue, Jul 1, 2008 at 1:34 PM, Nicolas Rougier <Nicolas.Rougier@...466...> wrote:
+
+ # Get a hold of the public IPython API object and use it
+ self.ip = ipapi.get()
+ self.ip.magic('colors LightBG')
+
         sys.excepthook = excepthook
         self.iter_more = 0
         self.complete_sep = re.compile('[\s\{\}\[\]\(\)]')

##### END PATCH

Cheers,

f