newbie question: wx import not working?

Hi,
the code above seems ok (for what it is supposed to do:).
What specific error (including the whole traceback) do you get? What
OS, python and wxpython version are you using?
If you are using python Idle to run the code, you may get some errors
in some more complex programs eventually, as there are two GUI systems
interfering (Tk and wx), however, this code works for me inside Idle
too.
hth,
   vbr

···

2012/7/21 Daniel Montenegro <dmontenegro84@gmail.com>:

Hi there!

Could someone say why this code isn't working? I mean, I run it (F5) at
Python Shell but then I receive a error message.

# Codigo para criar nova gui

import wx
app = wx.App()
win = wx.Frame(None)
win.Show()
app.MainLoop()

Thanks in advance,

Daniel

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Well, I’m using Python 2.7… as far as I know I’ve installed the right wxpython version (2.7). The OS is Windows 7.

This is the message error:

app = wx.App()
AttributeError: ‘module’ object has no attribute ‘App’

I really don’t know why this is happening.

Daniel

Hi Daniel,

Well, I'm using Python 2.7... as far as I know I've installed the right
wxpython version (2.7). The OS is Windows 7.

This is the message error:

app = wx.App()
AttributeError: 'module' object has no attribute 'App'

I really don't know why this is happening.

I get the same error on this Win7 laptop with Python 2.7 installed.

But I haven't installed wxPython yet. :slight_smile: Have you installed wxPython?

http://wxpython.org/download.php

HTH.

Cheers,
Scott.

···

On Sat, Jul 21, 2012 at 12:44 PM, Daniel Montenegro <dmontenegro84@gmail.com> wrote:

Daniel

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Well, I'm using Python 2.7... as far as I know I've installed the right
wxpython version (2.7). The OS is Windows 7.

Which version of wxPython? There will be two numbers in the installer file's name, one is the wxPython version, and the other is the version of Python that it was built for.

This is the message error:

app = wx.App()
AttributeError: 'module' object has no attribute 'App'

I really don't know why this is happening.

Either your wxPython install is broken, or was installed for the wrong Python, or there is some other wx package or module being found first. Look at the values in sys.path, and then examine each of the folders in that list. Check for any wx folder with a __init__.py in it, or a wx.py file. If there are either of those in a folder that comes before the real wxPython in your sys.path then that is the problem. Remove it.

Next check the wxPython install path. It should be something like {PythonLibDir}/site-pacakges/wx-X.Y-msw-unicode, and inside that folder will be the wx package. In {PythonLibDir}/site-pacakges there will also be a wx.pth file that contains the name of the wx-X.Y-msw-unicode folder, which is how it gets added to the sys.path.

···

On 7/21/12 9:44 AM, Daniel Montenegro wrote:

--
Robin Dunn
Software Craftsman

Thanks a lot, my friends! Now the wx is ok!

It was indeed a problem of incompatibility. Now I’ve unnistalled and installed again Python and wxPython (both 64 bits version) and it’s working fine.

Well, I would like to take this oportunity to ask where can I start searching form some nice wxPython GUI projects.

Thanks a lot!

Cheers,

Daniel