Hi, I need some help on how I could add the following pie chart to a wxPanel. I just can't seem to get it to work without the pylab interface.
import wx
from pylab import *
class MyFrame(wx.Frame):
""" Pie Chart Frame """
def __init__(self):
wx.Frame.__init__(self,None,-1)
self.panel=wx.Panel(self,-1)
""" Start Pie Chart Code"""
# make a square figure and axes
figure(1, figsize=(6,6))
ax = axes([0.1, 0.1, 0.8, 0.8])
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
fracs = [15,30,45, 10]
explode=(0, 0.05, 0, 0)
pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%', shadow=True)
title('Raining Hogs and Dogs', bbox={'facecolor':'0.8', 'pad':5})
show()
""" End Pie Chart Code"""
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame()
frame.Show()
return True
app = MyApp(redirect=False)
app.MainLoop()
app.Destroy()
Pie Chart Source...
http://matplotlib.sourceforge.net/examples/pylab_examples/pie_demo.html