toolbar issues

Hi,

I was trying to make updating plot not cause to change zoom.
I have wxPython program with embedded plot and I can change some
parameters what makes some changes on the plot. User should be able
to zoom and then change these parameters and see how it influences
plot, OTOH it should be easy to show whole plot, eg. using home button.
Perhaps I'm wrong, but I think its quite common requirement.

BTW pressing home button calls toolbar's draw() twice:

Index: lib/matplotlib/backend_bases.py

···

===================================================================
RCS file: /cvsroot/matplotlib/matplotlib/lib/matplotlib/backend_bases.py,v
retrieving revision 1.48
diff -u -u -1 -r1.48 backend_bases.py
--- lib/matplotlib/backend_bases.py 12 Apr 2005 16:07:12 -0000 1.48
+++ lib/matplotlib/backend_bases.py 28 Apr 2005 13:44:23 -0000
@@ -948,3 +948,2 @@
         self._update_view()
- self.draw()

My plot update looks like this:
        # toolbar is NavigationToolbar2
        old_view = toolbar._views()
        toolbar.update() #clear zoom history
        if old_view: #don't change current view
            toolbar.push_current()
            toolbar._views.push(old_view)
        toolbar._update_view()

I'd like to hear what do you think about it. Is a simpler way to make
the same? I'm writting my first mini-program that uses MPL and don't
know it well.

And why wx and gtk toolbars are different -- in GTK button descriptions
are in tooltips and x,y position is displayed in toolbar, and in wx
statusbar is used? Are they different by design? I prefer the first way,
without statusbar.

And last thing: what do you think about making toolbar2 more hmm..
interactive(?), i mean disabled back/forward buttons whan there is no
history, pressed pan/zoom buttons when in pan/zoom mode etc?
I don't know if I'll try to do it, but if someone would do it,
would it be included in MPL?

Marcin

--
Marcin Wojdyr | http://www.unipress.waw.pl/~wojdyr/

Hi Marcin,

And why wx and gtk toolbars are different -- in GTK button
descriptions are in tooltips and x,y position is displayed in
toolbar, and in wx statusbar is used? Are they different by
design? I prefer the first way, without statusbar.

Hmm, I'd guess they're different because no one noticed or
because 'desired behavior' is not obvious. Having tooltips does
seem like a good idea, and doable, but reporting x,y to the
statusbar seems like the right place to me.

And last thing: what do you think about making toolbar2 more
hmm.. interactive(?), i mean disabled back/forward buttons
whan there is no history, pressed pan/zoom buttons when in
pan/zoom mode etc? I don't know if I'll try to do it, but if
someone would do it, would it be included in MPL?

I think this is a good suggestion and not too difficult to do
for wx.

For the rest of your post, I realize this doesn't answer your
immediate questions, and may not be mpl-correct, but....:

My preference for Apps is to not use the toolbars at all.
Maybe this is because I never used Matlab, or maybe because I
confuse toolbar and toolbar2, and don't remember the meaning of
all the icons (is the left arrow "move left" or "back one view"?
which one is "pan/zoom" and which is "zoom to rectangle"? why
does 'axis' show up for plots with only one axis?). Also, the
toolbars take up room for something that is not used all the
time, and this functionality is (IMO) better in the menus or
toolbars of the Application or in pop-up menus. In short, I
don't think the toolbars are appropriate for Apps.

For my apps, I provide interactivity by binding left-click to
'report x,y coords', left-down-and-drag (ie, move more than a
few pixels) to 'Zoom to Rectangle', and have right-click bring
up a pop-up menu with 'zoom back 1 level', 'zoom back to full
view', and 'save image', among other things. That makes the
most important actions (report x,y, zoom in) always "on", and
the second most important actions (zoom out, save image) are
relatively easy to get to (right click on the plot then use
menu, as opposed to clicking on a toolbar button).

Maybe this negative opinion of the toolbars disqualifies me from
commenting on them (in which case, my apologies). Or maybe the
toolbars really aren't what you want in your apps, either.

I do think it would be possible to come up with yet another
binding mode (toolbar, toolbar2, ... no_toolbar, or toolbar0??),
where the above behavior was provided. I don't know if that
would be considered generally useful or not.

--Matt

Matt Newville wrote:

For my apps, I provide interactivity by binding left-click to
'report x,y coords', left-down-and-drag (ie, move more than a
few pixels) to 'Zoom to Rectangle', and have right-click bring
up a pop-up menu with 'zoom back 1 level', 'zoom back to full
view', and 'save image', among other things. That makes the

I'll think about it, perhaps its a better solution. With 3 buttons
and 1 wheel most of actions can be easily accessed.

I do think it would be possible to come up with yet another
binding mode (toolbar, toolbar2, ... no_toolbar, or toolbar0??),
where the above behavior was provided. I don't know if that
would be considered generally useful or not.

Probably it will be useful for me.

Marcin

···

--
Marcin Wojdyr | http://www.unipress.waw.pl/~wojdyr