can't creat ImageResources from a image

2010-09-30
2013-05-01
  • tadaovn toiloi

    tadaovn toiloi - 2010-09-30

    can't creat ImageResources from a image

     
  • Werner F. Bruhin

    What did you try?  Anyhow this sounds more like a wxPython question.

    This is how I do it:

    #!/usr/bin/env python
    #-----------------------------------------------

    """
    This is a way to save the startup time when running img2py on lots of
    files…
    """
    ##import wxversion
    ##wxversion.select('2.5')

    import sys
    from wx.tools import img2py
    from wx import EmptyIcon

    headerStuff = '''#Boa:PyImgResource:-----------------------------------
    # This file was generated by encode_mybitmaps.py
    #
    from wx.lib.embeddedimage import PyEmbeddedImage
    import cStringIO
    '''

    imageFile = file("../myimages.py", "w+")
    imageFile.write(headerStuff)
    imageFile.close()

    command_lines = [
            "-a -u -f -i -n image1 image1.png ../myimages.py",
            "-a -u -f -i -n image2 image2.png ../myimages.py",
           
        ]

    if __name__ == "__main__":
        for line in command_lines:
            args = line.split()
            img2py.main(args)

    And I use them like this:

    img = myimages.getbottleCopyImage()

    Hope this helps
    Werner

     
  • tadaovn toiloi

    tadaovn toiloi - 2010-10-01

    thanks you ,Werner!

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks