Test results and new questions

  Hi John, Thanks for the quick reply, I was really

    > happy to download the snapshot and see that it works. I
    > tested in on wxPython 2.5.1.5 without problems, it
    > would probably work the same on 2.4.2.4. I'm not quite
    > familiar with the toolbar functions, so I don't know if
    > the results I'm getting are right. The "home" button
    > seems to do something, I can see a visual indication of
    > the repaint when I press it. On the other hand, the
    > "pan" button seems to be disabled; even if I can press
    > it, I'm unable to select it (or it isn't supposed to be
    > selectable?) Maybe this is normal for the example that
    > you sent in your e-mail? Because of this, I can't test
    > the functionality of the back/forward buttons. The
    > "zoom to rect" button also seems to be disable,
    > probably because I didn't use the zoom function, which
    > is also related to the "pan" button, if I understand it
    > correctly. The "save" button worked when trying to save
    > a PNG image, but the program exited with a "Do not know
    > know to handle extension *.jpg" message printed on the
    > console when trying to save a JPG image. Again, I don't
    > know if this behavior is correct or not, I'm just
    > posting my results.

These buttons don't do what you think they do because they all work
very differently from the classic matplotlib toolbar (else why
introduce a new one!)

The Forward and Back buttons are akin to the web browser forward and
back buttons. They are used to navigate back and forth between
previously defined views. They have no meaning unless you have
already navigated somewhere else using the pan and zoom buttons. This
is analogous to trying to click 'back' on your web browser before
visiting a new page. Nothing happens. 'Home' always takes you to the
first view. For Home, Forward and Back, think web browser where data
views are web pages. Use the pan and zoom to rectangle to define new
views.

The "Pan" button has two modes: pan and zoom. Click this toolbar
button to activate this mode. Then put your mouse somewhere over an
axes. Mode 1: Press the left mouse button and hold it, dragging it to
a new position. When you release it, the data under the point where
you pressed will be moved to the point where you released. Mode 2:
Press the right mouse button, dragging it to a new position. The x
axis will be zoomed in proportionate to the rightward movement and
zoomed out proportionate to the leftward movement. Ditto for the
yaxis and up/down motions.

The Zoom to rectangle button: Click this toolbar button to activate
this mode. Put your mouse somewhere over and axes and press the left
mouse button. Drag the mouse while holding the button to a new
location and release. The axes view limits will be zoomed to the
rectangle you have defined.

Save: click this button to launch a file save dialog. All the *Agg
backends know how to save the following image types: PNG, PS, EPS,
SVG. There is no support currently in Agg for writing to JPEG, TIFF
(the regular wx and gtk backends handle these types). It is possible
to use matplotlib/agg + PIL to convert agg images to one of these
other formats if required. I can provide a recipe for you. I prefer
PNG over JPG and TIFF, which is why I haven't worked too hard to
include these other image formats in agg.

    > I don't plan on using the toolbar
    > in my application, I have another (specialized) toolbar
    > and I'll be using its functions.

OK, perhaps you could give it one more time just to make sure my
instructions above are clear and that it is working fine on your
system?

    > The new event handling mechanism is great and it's
    > exactly what I needed. However, I have a couple of
    > fresh new questions for you :slight_smile: The first one was also
    > present in my previous e-mail. When I create the plot
    > it has very large margins to the parent frame. This is
    > not convenient to me, as I'd like to have a plot that
    > is as large as possible and margins as small as
    > possible. Is there a way to modify these margins?

Yes, you can position axes anywhere you want in any size using the
axes command. See
http://matplotlib.sf.net/matplotlib.matlab.html#-axes and the example
http://matplotlib.sf.net/examples/axes_demo.py.

    > The other one is really new and it is related to
    > printing. Is there a way to print directly from the
    > library? I'm aware of the image save/image print combo
    > and I can use it if I have no other option. However, at
    > this point my application (which is quite critical)
    > blocks every task switching combination (ctrl+atl+del
    > included, together with alt+tab and all the others) in
    > order to force the user to use this application and
    > ONLY this application. If I choose the "image save"
    > option I'll be forced to give up this feature, and I
    > don't want that, as I _KNOW_ that they'll start to play
    > starcraft in a flash :slight_smile: Unless there is some Python
    > source somewhere that can send an image to the
    > printer. I've been searching for it, but never found
    > it. I also had this problem with PyPlot, that offers
    > printing functions, but they don't seem to work :frowning:
    > (this was tested on two different printers). Then
    > again, the "Print framework" sample from the wxPython
    > 2.5.1.5 demo also crashed when trying to print, so I
    > imagine that the printing support in wxPython is not at
    > its best at this point :frowning: If anybody has a solution for
    > this, please let me know. Thank you all for your help.

cross platform printing is pretty hard, and cross-gui/cross-platform
printing is event harder. If you get wx printing figured out and want
to submit some code, I'd be happy to include it. When I was initially
trying to decide on a GUI for my own application work, poor printing
support in wx the thing that initially steered me to GTK.

JDH

Ok, I tested the toolbar again and this time everything is fine. I
guess that I was distracted by the fact that the "Pan" and "Zoom to
rectangle" buttons don't look as they are pressed when I press them :slight_smile:
I mean, they don't change their visual appearance. They look like
normal buttons, but they should probably be toggle buttons. Apart from
that, everything else is fine. I don't need a recipe for JPG, i also
prefer PNG, i just signaled this because I thought it was a problem.
For printing ... I don't know :frowning: I'll try to post a question to the wx
list and come back to you all if I receive a solution.
    Thank you very much for your support. Yes, again :slight_smile:

    Bogdan

···

On Thu, 22 Jul 2004 07:24:21 -0500, John Hunter <jdhunter@...4...> wrote:

    > Hi John, Thanks for the quick reply, I was really
    > happy to download the snapshot and see that it works. I
    > tested in on wxPython 2.5.1.5 without problems, it
    > would probably work the same on 2.4.2.4. I'm not quite
    > familiar with the toolbar functions, so I don't know if
    > the results I'm getting are right. The "home" button
    > seems to do something, I can see a visual indication of
    > the repaint when I press it. On the other hand, the
    > "pan" button seems to be disabled; even if I can press
    > it, I'm unable to select it (or it isn't supposed to be
    > selectable?) Maybe this is normal for the example that
    > you sent in your e-mail? Because of this, I can't test
    > the functionality of the back/forward buttons. The
    > "zoom to rect" button also seems to be disable,
    > probably because I didn't use the zoom function, which
    > is also related to the "pan" button, if I understand it
    > correctly. The "save" button worked when trying to save
    > a PNG image, but the program exited with a "Do not know
    > know to handle extension *.jpg" message printed on the
    > console when trying to save a JPG image. Again, I don't
    > know if this behavior is correct or not, I'm just
    > posting my results.

These buttons don't do what you think they do because they all work
very differently from the classic matplotlib toolbar (else why
introduce a new one!)

The Forward and Back buttons are akin to the web browser forward and
back buttons. They are used to navigate back and forth between
previously defined views. They have no meaning unless you have
already navigated somewhere else using the pan and zoom buttons. This
is analogous to trying to click 'back' on your web browser before
visiting a new page. Nothing happens. 'Home' always takes you to the
first view. For Home, Forward and Back, think web browser where data
views are web pages. Use the pan and zoom to rectangle to define new
views.

The "Pan" button has two modes: pan and zoom. Click this toolbar
button to activate this mode. Then put your mouse somewhere over an
axes. Mode 1: Press the left mouse button and hold it, dragging it to
a new position. When you release it, the data under the point where
you pressed will be moved to the point where you released. Mode 2:
Press the right mouse button, dragging it to a new position. The x
axis will be zoomed in proportionate to the rightward movement and
zoomed out proportionate to the leftward movement. Ditto for the
yaxis and up/down motions.

The Zoom to rectangle button: Click this toolbar button to activate
this mode. Put your mouse somewhere over and axes and press the left
mouse button. Drag the mouse while holding the button to a new
location and release. The axes view limits will be zoomed to the
rectangle you have defined.

Save: click this button to launch a file save dialog. All the *Agg
backends know how to save the following image types: PNG, PS, EPS,
SVG. There is no support currently in Agg for writing to JPEG, TIFF
(the regular wx and gtk backends handle these types). It is possible
to use matplotlib/agg + PIL to convert agg images to one of these
other formats if required. I can provide a recipe for you. I prefer
PNG over JPG and TIFF, which is why I haven't worked too hard to
include these other image formats in agg.

    > I don't plan on using the toolbar
    > in my application, I have another (specialized) toolbar
    > and I'll be using its functions.

OK, perhaps you could give it one more time just to make sure my
instructions above are clear and that it is working fine on your
system?

    > The new event handling mechanism is great and it's
    > exactly what I needed. However, I have a couple of
    > fresh new questions for you :slight_smile: The first one was also
    > present in my previous e-mail. When I create the plot
    > it has very large margins to the parent frame. This is
    > not convenient to me, as I'd like to have a plot that
    > is as large as possible and margins as small as
    > possible. Is there a way to modify these margins?

Yes, you can position axes anywhere you want in any size using the
axes command. See
http://matplotlib.sf.net/matplotlib.matlab.html#-axes and the example
http://matplotlib.sf.net/examples/axes_demo.py.

    > The other one is really new and it is related to
    > printing. Is there a way to print directly from the
    > library? I'm aware of the image save/image print combo
    > and I can use it if I have no other option. However, at
    > this point my application (which is quite critical)
    > blocks every task switching combination (ctrl+atl+del
    > included, together with alt+tab and all the others) in
    > order to force the user to use this application and
    > ONLY this application. If I choose the "image save"
    > option I'll be forced to give up this feature, and I
    > don't want that, as I _KNOW_ that they'll start to play
    > starcraft in a flash :slight_smile: Unless there is some Python
    > source somewhere that can send an image to the
    > printer. I've been searching for it, but never found
    > it. I also had this problem with PyPlot, that offers
    > printing functions, but they don't seem to work :frowning:
    > (this was tested on two different printers). Then
    > again, the "Print framework" sample from the wxPython
    > 2.5.1.5 demo also crashed when trying to print, so I
    > imagine that the printing support in wxPython is not at
    > its best at this point :frowning: If anybody has a solution for
    > this, please let me know. Thank you all for your help.

cross platform printing is pretty hard, and cross-gui/cross-platform
printing is event harder. If you get wx printing figured out and want
to submit some code, I'd be happy to include it. When I was initially
trying to decide on a GUI for my own application work, poor printing
support in wx the thing that initially steered me to GTK.

JDH

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Bogdan