how to add icon in sizer, crash

Hi!

Can anyone tell me what's wrong with my code?
I want to add an icon to my application window (sizer)
so I have to create a staticBitmap as far as I understood.

So I used this code, but it always crashes during the
staticBitmap creation.

I am using python 2.2 and wxPython 2.3

Thanks a lot, Fabian

from wxPython.wx import *

wxPythonApp = wxPySimpleApp()

bitmap = None
staticbitmap = None

icon = wxIcon("wxICON_QUESTION", wxBITMAP_TYPE_ICO)

if icon != None:
    bitmap = wxBitmapFromIcon(icon)

if bitmap != None:
    staticbitmap = wxStaticBitmap(None, -1, bitmap)

wx.StaticBitmap needs a parent, for example the window in which you want to place the bitmap (icon).

Just out of curiosity... why are you using such old versions of both python and wxpython?
a lot of problems have been fixed in the last years...

Peter.

···

On Fri, 24 Jun 2005 10:18:16 +0300, <sturm@rtfs.org> wrote:

Hi!

Can anyone tell me what's wrong with my code?
I want to add an icon to my application window (sizer)
so I have to create a staticBitmap as far as I understood.

So I used this code, but it always crashes during the
staticBitmap creation.

I am using python 2.2 and wxPython 2.3

Thanks a lot, Fabian

from wxPython.wx import *

wxPythonApp = wxPySimpleApp()

bitmap = None
staticbitmap = None

icon = wxIcon("wxICON_QUESTION", wxBITMAP_TYPE_ICO)

if icon != None:
    bitmap = wxBitmapFromIcon(icon)

if bitmap != None:
    staticbitmap = wxStaticBitmap(None, -1, bitmap)