 examples/user_interfaces/embedding_in_wx5.py | 20 ++++++--
 lib/matplotlib/backends/backend_wx.py        | 74 ++++++++++++++++++++--------
 2 files changed, 69 insertions(+), 25 deletions(-)

diff --git a/examples/user_interfaces/embedding_in_wx5.py b/examples/user_interfaces/embedding_in_wx5.py
index fd3969a..9d39896 100644
--- a/examples/user_interfaces/embedding_in_wx5.py
+++ b/examples/user_interfaces/embedding_in_wx5.py
@@ -1,9 +1,14 @@
 # Used to guarantee to use at least Wx2.8
 import wxversion
-wxversion.ensureMinimal('2.8')
+#wxversion.ensureMinimal('2.8')
+#wxversion.select('2.8')
+wxversion.select('2.9.6') # phoenix
+
 
 import wx
-import wx.aui
+print wx.VERSION_STRING
+
+import wx.lib.agw.aui as aui
 import matplotlib as mpl
 from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas
 from matplotlib.backends.backend_wxagg import NavigationToolbar2Wx as Toolbar
@@ -20,11 +25,17 @@ class Plot(wx.Panel):
         sizer.Add(self.canvas,1,wx.EXPAND)
         sizer.Add(self.toolbar, 0 , wx.LEFT | wx.EXPAND)
         self.SetSizer(sizer)
+        self.Bind(wx.EVT_PAINT, self.OnPaint)
+        
+    def OnPaint(self, event):
+        self.canvas.draw()
+        event.Skip()
+        
 
 class PlotNotebook(wx.Panel):
     def __init__(self, parent, id = -1):
         wx.Panel.__init__(self, parent, id=id)
-        self.nb = wx.aui.AuiNotebook(self)
+        self.nb = aui.AuiNotebook(self)
         sizer = wx.BoxSizer()
         sizer.Add(self.nb, 1, wx.EXPAND)
         self.SetSizer(sizer)
@@ -36,7 +47,8 @@ class PlotNotebook(wx.Panel):
 
 
 def demo():
-    app = wx.PySimpleApp()
+    import wx.lib.mixins.inspection as wit
+    app = wit.InspectableApp()
     frame = wx.Frame(None,-1,'Plotter')
     plotter = PlotNotebook(frame)
     axes1 = plotter.add('figure 1').gca()
diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py
index b58433f..251bac0 100644
--- a/lib/matplotlib/backends/backend_wx.py
+++ b/lib/matplotlib/backends/backend_wx.py
@@ -665,8 +665,6 @@ class FigureCanvasWx(FigureCanvasBase, wx.Panel):
         wx.WXK_DELETE          : 'delete',
         wx.WXK_HOME            : 'home',
         wx.WXK_END             : 'end',
-        wx.WXK_PRIOR           : 'pageup',
-        wx.WXK_NEXT            : 'pagedown',
         wx.WXK_PAGEUP          : 'pageup',
         wx.WXK_PAGEDOWN        : 'pagedown',
         wx.WXK_NUMPAD0         : '0',
@@ -689,8 +687,6 @@ class FigureCanvasWx(FigureCanvasBase, wx.Panel):
         wx.WXK_NUMPAD_RIGHT    : 'right',
         wx.WXK_NUMPAD_DOWN     : 'down',
         wx.WXK_NUMPAD_LEFT     : 'left',
-        wx.WXK_NUMPAD_PRIOR    : 'pageup',
-        wx.WXK_NUMPAD_NEXT     : 'pagedown',
         wx.WXK_NUMPAD_PAGEUP   : 'pageup',
         wx.WXK_NUMPAD_PAGEDOWN : 'pagedown',
         wx.WXK_NUMPAD_HOME     : 'home',
@@ -734,7 +730,10 @@ class FigureCanvasWx(FigureCanvasBase, wx.Panel):
 
 
         # Create the drawing bitmap
-        self.bitmap =wx.EmptyBitmap(w, h)
+        if 'phoenix' in wx.PlatformInfo:
+            self.bitmap =wx.Bitmap(w, h)
+        else:
+            self.bitmap =wx.EmptyBitmap(w, h)
         DEBUG_MSG("__init__() - bitmap w:%d h:%d" % (w,h), 2, self)
         # TODO: Add support for 'point' inspection and plot navigation.
         self._isDrawn = False
@@ -1055,7 +1054,10 @@ The current aspect ratio will be kept."""
             bind(self, wx.EVT_TIMER, self.stop_event_loop, id=id)
 
         # Event loop handler for start/stop event loop
-        self._event_loop = wx.EventLoop()
+        if 'phoenix' in wx.PlatformInfo:
+            self.event_loop = wx.GUIEventLoop()
+        else:
+            self._event_loop = wx.EventLoop()
         self._event_loop.Run()
         timer.Stop()
 
@@ -1105,10 +1107,13 @@ The current aspect ratio will be kept."""
             if drawDC is None:
                 drawDC=wx.ClientDC(self)
 
-            drawDC.BeginDrawing()
-            drawDC.DrawBitmap(self.bitmap, 0, 0)
-            drawDC.EndDrawing()
-            #wx.GetApp().Yield()
+                if 'phoenix' in wx.PlatformInfo:
+                    drawDC.DrawBitmap(self.bitmap, 0, 0)
+                else:
+                    drawDC.BeginDrawing()
+                    drawDC.DrawBitmap(self.bitmap, 0, 0)
+                    drawDC.EndDrawing()
+                    #wx.GetApp().Yield()
         else:
             pass
 
@@ -1159,7 +1164,10 @@ The current aspect ratio will be kept."""
         width = int(math.ceil(width))
         height = int(math.ceil(height))
 
-        self.bitmap = wx.EmptyBitmap(width, height)
+        if 'phoenix' in wx.PlatformInfo:
+            self.bitmap = wx.Bitmap(width, height)
+        else:
+            self.bitmap = wx.EmptyBitmap(width, height)
         renderer = RendererWx(self.bitmap, self.figure.dpi)
 
         gc = renderer.new_gc()
@@ -1220,7 +1228,10 @@ The current aspect ratio will be kept."""
         DEBUG_MSG("_onSize()", 2, self)
         # Create a new, correctly sized bitmap
         self._width, self._height = self.GetClientSize()
-        self.bitmap =wx.EmptyBitmap(self._width, self._height)
+        if 'phoenix' in wx.PlatformInfo:
+            self.bitmap =wx.Bitmap(self._width, self._height)
+        else:
+            self.bitmap =wx.EmptyBitmap(self._width, self._height)
         self._isDrawn = False
 
         if self._width <= 1 or self._height <= 1: return # Empty figure
@@ -1237,8 +1248,10 @@ The current aspect ratio will be kept."""
         FigureCanvasBase.resize_event(self)
 
     def _get_key(self, evt):
-
-        keyval = evt.m_keyCode
+        if 'phoenix' in wx.PlatformInfo:
+            keyval = evt.KeyCode
+        else:
+            keyval = evt.m_keyCode
         if keyval in self.keyvald:
             key = self.keyvald[keyval]
         elif keyval < 256:
@@ -1812,13 +1825,29 @@ class NavigationToolbar2Wx(NavigationToolbar2, wx.ToolBar):
             if text is None:
                 self.AddSeparator()
                 continue
-            self.wx_ids[text] = wx.NewId()
-            if text in ['Pan', 'Zoom']:
-               self.AddCheckTool(self.wx_ids[text], _load_bitmap(image_file + '.png'),
-                                 shortHelp=text, longHelp=tooltip_text)
+            self.wx_ids[text] = int(wx.NewId())
+            if 'phoenix' in wx.PlatformInfo:
+                if text in ['Pan', 'Zoom']:
+                    self.AddTool(self.wx_ids[text], label=text,
+                                 bitmap=_load_bitmap(image_file + '.png'),
+                                 bmpDisabled=wx.NullBitmap,
+                                 shortHelpString=text,
+                                 longHelpString=tooltip_text,
+                                 kind=wx.ITEM_CHECK)
+                else:
+                    self.AddTool(self.wx_ids[text], label=text,
+                                 bitmap=_load_bitmap(image_file + '.png'),
+                                 bmpDisabled=wx.NullBitmap,
+                                 shortHelpString=text,
+                                 longHelpString=tooltip_text,
+                                 kind=wx.ITEM_NORMAL)
             else:
-               self.AddSimpleTool(self.wx_ids[text], _load_bitmap(image_file + '.png'),
-                                  text, tooltip_text)
+                if text in ['Pan', 'Zoom']:
+                    self.AddCheckTool(self.wx_ids[text], _load_bitmap(image_file + '.png'),
+                                      shortHelp=text, longHelp=tooltip_text)
+                else:
+                    self.AddSimpleTool(self.wx_ids[text], _load_bitmap(image_file + '.png'),
+                                       text, tooltip_text)
             bind(self, wx.EVT_TOOL, getattr(self, callback), id=self.wx_ids[text])
 
         self.Realize()
@@ -1877,7 +1906,10 @@ class NavigationToolbar2Wx(NavigationToolbar2, wx.ToolBar):
                 error_msg_wx(str(e))
 
     def set_cursor(self, cursor):
-        cursor =wx.StockCursor(cursord[cursor])
+        if 'phoenix' in wx.PlatformInfo:
+            cursor = wx.Cursor(cursord[cursor])            
+        else:
+            cursor = wx.StockCursor(cursord[cursor])
         self.canvas.SetCursor( cursor )
 
     def release(self, event):
