Hi All,
I've encountered this problem with the both NavigationToolbar2Wx and the
NavigationToolbar2WxAgg.
When I click the Zoom or Pan button the button disappears. The functionality is
maintained so if a click the location that the button used to be displayed at
the toggle action still works its just that the button is no longer displayed.
Can any one help me fix this?
Thanks
David
Here's the code that demonstrated the problem"
######################################
##### Start of Code #################
######################################
#!/usr/bin/env python
# encoding: UTF-8
"""
Basic wxPython App w DrawPanel.py
"""
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import os
import time
import numpy as np
import matplotlib
matplotlib.use('WXAgg')
from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg
from matplotlib.figure import Figure
import pylab as plt
import wx
from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
class DrawPanel(wx.Panel):
""" This class constructs a Matplotlib figure and canvas to allow for
plots. """
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
#Create the widgets
self.figure = Figure(figsize=(1,1))
self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
self.toolbar = NavigationToolbar2WxAgg(self.canvas)
sizer = wx.BoxSizer(wx.VERTICAL)
# add to sizer allows resizing
sizer.Add(self.toolbar, 0, wx.LEFT|wx.TOP)
sizer.Add(self.canvas, 1, wx.LEFT|wx.TOP|wx.GROW)
self.SetSizer(sizer)
self.Fit()
# plot some data
self.x=np.arange(0,10,.1)
self.y=plt.sin(self.x)
self.init_plot()
def init_plot(self):
self.figure.clf()
self.ax = self.figure.gca()
self.ax.plot(self.x, self.y)
self.canvas.draw()
########################################################################
class MainFrame(wx.Frame):
"""This is the Main Frame"""
#----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
wx.Frame.__init__(self, None, title="Basic wxPython App w
DrawPanel",size=(800,600))
# Create StatusBar
self.sb=self.CreateStatusBar()
self.SetStatusText('Basic wxPython App w DrawPanel')
#------------------------------
self.Freeze() # need this to prevent flicker during plot
resize/redraw
self.mainpanel = DrawPanel(self)
self.Layout()
self.Thaw()
self.Show()
#----------------------------------------------------------------------
if __name__ == "__main__":
app = wx.App(False)
frame = MainFrame()
app.MainLoop()
######################################
##### End of Code #################
######################################
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users