Simple problem with wxPython

Post here if you need help with creating a Graphical User Interface in Python.

Simple problem with wxPython

Postby deltamalloc » Fri Aug 09, 2013 3:11 pm

I'm trying to get the following to run on Gentoo:

Code: Select all
#!/usr/bin/env python
import wx

app = wx.App(False)  # Create a new app, don't redirect stdout/stderr to a window.
frame = wx.Frame(None, wx.ID_ANY, "Hello World") # A Frame is a top-level window.
frame.Show(True)     # Show the frame.
app.MainLoop()


However I get the following error:

Code: Select all
$ python test.py
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    import wx
ImportError: No module named wx


Despite that I have installed wxpython. Do I need something else? What is wrong?
deltamalloc
 
Posts: 2
Joined: Fri Aug 09, 2013 3:09 pm

Re: Simple problem with wxPython

Postby stranac » Fri Aug 09, 2013 3:59 pm

Are you sure you have installed it for the same version of python you're running it with?
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1117
Joined: Thu Feb 07, 2013 3:42 pm

Re: Simple problem with wxPython

Postby deltamalloc » Fri Aug 09, 2013 4:23 pm

It seems that it got installed for python2, but the default python to execute is version 3. I just realized this before you posted, but thank you.
deltamalloc
 
Posts: 2
Joined: Fri Aug 09, 2013 3:09 pm


Return to GUI

Who is online

Users browsing this forum: No registered users and 2 guests

cron