Search code examples
pythonubuntuwxpython

Installing wxPython in Ubuntu 12.10


I am trying to install wxPython on my Ubuntu 12.10 but with no success. I have gone through all the answers given on this website. Can someone please help me in this or point me in the right direction.

Initially, I tried http://wxpython.org/BUILD.html but then I came to know that it is in the repository, I ran "sudo apt-get install install python-wxgtk2.8", it installed without any error but then, when I run it, it is still unavailable. I guess I am doing something in the running step.

Also, although it is working in Eclipse using PyDev, but I am getting this warning " LIBDBUSMENU-GLIB-WARNING **: Trying to remove a child that doesn't believe we're it's parent."" after I close the application and the status bar is also not working,

Here is my code:

import wx

class naman(wx.Frame):
    def __init__(self,parent,id):  # @ReservedAssignment
        wx.Frame.__init__(self,parent,id,'Frame aka Window', size=(300,200))
        panel=wx.Panel(self)

        statusbar=self.CreateStatusBar()
        menubar=wx.MenuBar()
        first=wx.Menu()
        second=wx.Menu()
        first.Append(wx.NewId(),"New Window", "This opens a new window")
        first.Append(wx.NewId(),"Open...", "This will open")
        second.Append(wx.NewId(),"Undo", "This will undo")
        second.Append(wx.NewId(),"Redo", "This will redo")
        menubar.Append(first,"File")
        menubar.Append(second,"Edit")
        self.SetMenuBar(menubar)
    if __name__=='__main__':
    app=wx.PySimpleApp()
    frame=naman(parent=None,id=-1)
    frame.Show()
    app.MainLoop()

If someone can tell why I am getting this warning and why status bar is not working, that would be great too!! Then, I can continue working in eclipse itself and don't bother about wxPython.

PS: I have Python2.7 and Python3.3 already installed.

Thanks in advance.


Solution

  • You need to install wxPython Phoenix, not 2.8. The 2.8 series and the 2.9 Classic series are only Python 2.x compatible. You'll have to grab a Phoenix snapshot to build against as it is the only version that is Python 3 compatible. You can get one here:

    Note that Phoenix is very beta in that it only supports the core widgets currently. Most of the custom widgets, like those in wx.lib, are still being ported. See http://wiki.wxpython.org/ProjectPhoenix for more information.