4

I saw the following example:

Embedding a matplotlib figure inside a WxPython panel

I got the example to work, however, is there a way to make the chart/plot interactive such as the one that is produced by:

http://matplotlib.sourceforge.net/examples/pylab_examples/finance_demo.html

The latter has a zoom, pan functionality which is what I would like to embed in my GUI.

Community
  • 1
  • 1
Joshua
  • 1,516
  • 2
  • 22
  • 31

1 Answers1

2

I got this working...

    chart_toolbar = NavigationToolbar2Wx(chart_canvas)
    tw, th = chart_toolbar.GetSizeTuple()
    fw, fh = chart_canvas.GetSizeTuple()
    chart_toolbar.SetSize(wx.Size(fw, th))
    chart_toolbar.Realize()

    graphs_sizer = wx.BoxSizer(wx.VERTICAL)

    graphs_sizer.Add(chart_canvas, 20, flag=wx.EXPAND, border=5)
    graphs_sizer.Add(chart_toolbar, 1, flag=wx.ALIGN_CENTER, border=5)

    graphs_panel.SetSizer(graphs_sizer)

For whatever reason I have not been able to put the toolbar on a different sizer/panel. Otherwise it works. If someone can get it on a different sizer, that would be greatly appreciated.

Joshua
  • 1,516
  • 2
  • 22
  • 31