Hi y´all.

I´m more than a little green at this and have been trying to get an understandig of Python.

I came across WXPython and decided to try the first program in the tutorial by Fuze
I´ve downloaded and installed python 2.6.3 and Wxpython 2.8.10.1.
I´ve also got Python 3.1 installed previously but Wx demanded Python 2.6.

Here´s what i typed in:

import wx
"""The start of our wxPython tutorial"""

app = wx.App(redirect=False)

window = wx.Frame(None, title = 'Sample GUI App.')
btn = wx.Button(window)

Window.Show()
app.Mainloop()

As far as i can see exactly the same as the first example by Fuze.
I stored the program.
I tried running from a command prompt: Got runtime error bad magic number????

I tried running from "this computer" on windows desktop: a command prompt opens and closes almost instantly.

I tried copying the program into IDLE for Python 2.6 and got zero/nothing/nada result.

I tried copying the program directly from the tutorial with the same result.

I´m running XP-pro on a bog-standard computer.

Please help!!

Regards
ELO

Recommended Answers

All 5 Replies

Try changing line 9 to window.Show()

And also change the like

app.Mainloop()

to

app.MainLoop()

Works now - thanks a bundle
Also i had to add a .pyw file extension to make it work.
Evidently that´s important.
again - thanks for taking the time folks :-)

All that the .pyw extension does that the .py doesn't is make that black window "python.exe" not show up, which is useful for wxPython apps, sometimes :P

I trust that by now you have figured out that names in Python are case sensitive.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.