Here is the link to the code I found on the web (embedding matplotlib in wxpython):
http://eli.thegreenplace.net/files/prog_code/wx_mpl_bars.py.txt
My question is does anybody know why menubar appears with some delay? And is there a way how to get rid of this delay?
Thanks!
Reading the code, the problem might be that
self.draw_figure()is the culprit here. wx needs to render the frame, but can only do that as soon as the main thread (running wx) is cleared. My guess is thatself.draw_figure()is a computation-heavy method call and blocks the drawing of the menubar. Try usingwx.CallAfter(self.draw_figure), to free up the thread. After all other rendering has finished, the figure will be drawn.PS: I do not have wx 2.8 installed (required for matplotlib), so I cannot verify if this is completely valid.