charts - Adding Matplotlib to Panel from wxglade -


Hi I'm trying to add a matplotlib chart example from the link below

For the panel within the wxpython frame generated using WXGlade. Is there a panel panel panel which requires a chart?

  #! / Usr / bin / env python # - * - coding: 0.68 (standalone version) generated by CP1252 - * - # # wxGlade on Thu 31 July 22:23:21 2014 # import wx # start wxGlade: dependency import gettext # finally wxGlade # start wxGlade: extracode # end wxGlade class MyFrame1 (wx.Frame): def __init __ (self, * args, ** kwds): # start wxGlade: MyFrame1 .__ init__ kwds [ "style"] = wx.DEFAULT_FRAME_STYLE wx.Frame .__ init __ (self, * args, ** kwds) self.panel_22 = wx.Panel (self, wx.ID_ANY) self .__ set_properties () self .__ do_layout () # end wxGlade def __set_properties (self ): # start wxGlade: MyFrame1 .__ set_properties self.SetTitle (_ ( "frame_2")) # end wxGlade def __do_layout (self): MyFrame1 .__ do_layout sizer_ 21 = wx.BoxSizer (wx: #wxGlade begin.VERTICAL) grid_sizer_4 = wx.GridSizer (3, 3, 0, 0) grid_sizer_4. Add (own. Panel 22, 1, wx.EXPAND, 0) sizer_21. Ed (Grid_sijh er_4, 1, wx.EXPAND, 0) self.SetSizer (sizer_21) sizer_21.Fit (self) self.Layout () # end wxGlade # square end MyFrame1 if __name__ == "__main__": gettext.install ( "app") # appropriate list app = wx.App (false) wx.InitAllImageHandlers () frame_2 = MyFrame1 (no, wx.ID_ANY, " ") Replace app.SetTopWindow (frame_2) with frame_2.Show () app.MainLoop ()  

It does not matter whether it is produced in the glade or not. So try

Two import add before

    

And then add two rows at the beginning of __do_layout:

  def __do_layout (self): self.figure = picture () self.canvas = figure image (self, panel_22, -1, self.) # Start wxGlade: myFrame1 .__ do_layout  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -