wx.Icon from Stream

Hi !

I want to load main form's icon from stream, because I want to hide this icon from users (if they see main.ico in bin directory, they can replace it...:frowning: )

Because that I created a resource.py file that contain resource datas in a dictionary that pickled and hexlified, so the data stored in one string.

When I load the application's main form, I unhexlify and unpickle this string, I get the dictionary with binary datas.

This way I can load some pictures (bitmaps) very well, and these datas are hided, user cannot change them simply.

But I cannot load ico file from stream, because wx.Icon() need 2 parameters, a path, and a format, and I don't create icon without this parameters...

How can I load wx.Icon data from binary stream ?

Please help me !

Thanx for it:
dd

Durumdara wrote:

Hi !

I want to load main form's icon from stream, because I want to hide this icon from users (if they see main.ico in bin directory, they can replace it...:frowning: )

Because that I created a resource.py file that contain resource datas in a dictionary that pickled and hexlified, so the data stored in one string.

When I load the application's main form, I unhexlify and unpickle this string, I get the dictionary with binary datas.

This way I can load some pictures (bitmaps) very well, and these datas are hided, user cannot change them simply.

But I cannot load ico file from stream, because wx.Icon() need 2 parameters, a path, and a format, and I don't create icon without this parameters...

How can I load wx.Icon data from binary stream ?

If you use the img2py.py tool and give it the -i flag then it will create a .py file with the image data embedded and also a function you can call that will return a wx.Icon.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!