I am using wxPython. I need to be able to add and remove panels/canvases on demand, but I don't know how to refresh the entire parent frame (the base starting window). I tried fooling with the Full_Repaint option, but got no where. The method I am using, to add and (hopefully) refresh the frame, Add_Canvas(), starts at line 50.
Code:
canvas_List = [Cone_Canvas, CubeCanvas] class MainWindow(wx.Frame): def __init__(self, parent = None, id = -1, title = "PyOpenGL Example 1"): # Init wx.Frame.__init__( self, parent, id, title, size = (400,200), style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE ) # TextCtrl # self.control = wx.TextCtrl(self, -1, style = wx.TE_MULTILINE) #self.control = ConeCanvas(self) box = wx.BoxSizer(wx.HORIZONTAL) for canvas in canvas_List: box.Add(canvas(self), 1, wx.EXPAND) self.SetAutoLayout(True) self.SetSizer(box) self.Layout() # StatusBar self.CreateStatusBar() # Filemenu filemenu = wx.Menu() # Filemenu - About menuitem = filemenu.Append(-1, "Add Canvas", "Add a Canvas") self.Bind(wx.EVT_MENU, self.Add_Canvas, menuitem) # here comes the event-handler # Filemenu - Separator filemenu.AppendSeparator() # Filemenu - Exit menuitem = filemenu.Append(-1, "E&xit", "Terminate the program") self.Bind(wx.EVT_MENU, self.OnExit, menuitem) # here comes the event-handler # Menubar menubar = wx.MenuBar() menubar.Append(filemenu,"&File") self.SetMenuBar(menubar) # Show self.Show(True) #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!# # What do I call(or can I call anything at all?) to # repaint the entire frame? def Add_Canvas(self,event): canvas_List.append(Cube_Canvas) Repaint_Frame() # <---- pseudo.... #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!# def OnExit(self,event): self.Close(True) # Close the frame.
Comment