0

Hey guys trying to compile code, and heres the error I receive. im fairly new to python programming so any help would be appreciated. thanks in advance.
ms7538@ms:~/Desktop$ ./test.py
Traceback (most recent call last):
File "./test.py", line 10, in <module>
class Panel1(wx.Panel):
File "./test.py", line 22, in Panel1
bmp = wx.BitmapFromImage( wx.ImageFromStream( stream ))
File "/usr/lib/python2.5/site-packages/wx-2.6-gtk2-unicode/wx/_gdi.py", line 749, in BitmapFromImage
val = _gdi_.new_BitmapFromImage(*args, **kwargs)
wx._core.PyNoAppError: The wx.App object must be created first!

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by bumsfeld
0

When you use wxPython, as with Tkinter, the application has to be initialized first in order to set all kinds of screen parameters.

So the code you are trying to compile is only partially there. Did you write it yourself, or is it someone else's?

0

You should start your wxPython program with something like that:

app = wx.App(0)
MyFrame(None, -1, 'frame title')
app.MainLoop()

or that:

class MyApp(wx.App):
    def OnInit(self):
        frame = MyFrame(None, -1, 'frame title')
        frame.Show(True)
        self.SetTopWindow(frame)
        return True

app = MyApp(0)
app.MainLoop()
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.