3 questions

Hello everybody,
I have the following questions.
1. How can I convert a large bitmap to a bitmap that is suitable (its size) for ToolBar bitmap?

2. Where/How can I get standard toolbar bitmaps for Open, Save, New etc. that Windows
use?

3. How can I include the bitmaps into my source python code?
I saw something like

def GetPlusData():
    return cPickle.loads(zlib.decompress(
'x\xda\xd3\xc8)0\xe4\nV72T\x00!\x05Cu\xae\xc4`u=\x85d\x05\xa7\x9c\xc4\xe4l0O\
\x01\xc8S\xb6t\x06A(\x1f\x0b RF\x0f\x08\xb0\xc9@D\xe1r\x08\x19\xb8j=l2`\r\
\xe82HF\xe9a\xc8\xe8\xe9A\x9c@\x8a\x0c\x0e\xd3p\xbb\x00\x8f\xab\xe1>\xd5\xd3\
\xc3\x15:P)l!\n\x91\xc2\x1a\xd6`)\xec\xb1\x00\x92\xc2\x11?\xb8e\x88\x8fSt\
\x19=\x00\x82\x16[\xf7' ))

def GetPlusBitmap():
    return wxBitmapFromXPMData(GetPlusData())

def GetPlusImage():
    return wxImageFromBitmap(GetPlusBitmap())

but I do not understand.
Can anybody explain that?
Thanks
Ladislav

BMA TRADING wrote:

Hello everybody,
I have the following questions.
1. How can I convert a large bitmap to a bitmap that is suitable (its size) for ToolBar bitmap?

  img = bmp.ConvertToImage()
  img = img.Scale(16,16)
  bmp = img.COnvertToBitmap()

2. Where/How can I get standard toolbar bitmaps for Open, Save, New etc. that Windows use?

There are lots of icon collections on the web that you can choose from. There are also some icons/bitmaps available with the microsoft developer tools, and etc.

3. How can I include the bitmaps into my source python code?
I saw something like

def GetPlusData():
    return cPickle.loads(zlib.decompress(
'x\xda\xd3\xc8)0\xe4\nV72T\x00!\x05Cu\xae\xc4`u=\x85d\x05\xa7\x9c\xc4\xe4l0O\
\x01\xc8S\xb6t\x06A(\x1f\x0b RF\x0f\x08\xb0\xc9@D\xe1r\x08\x19\xb8j=l2`\r\
\xe82HF\xe9a\xc8\xe8\xe9A\x9c@\x8a\x0c\x0e\xd3p\xbb\x00\x8f\xab\xe1>\xd5\xd3\
\xc3\x15:P)l!\n\x91\xc2\x1a\xd6`)\xec\xb1\x00\x92\xc2\x11?\xb8e\x88\x8fSt\
\x19=\x00\x82\x16[\xf7' ))

def GetPlusBitmap():
    return wxBitmapFromXPMData(GetPlusData())

def GetPlusImage():
    return wxImageFromBitmap(GetPlusBitmap())

wxPython comes with a command-line tool called img2py that will do this for you. It simply imports from wx.tools.img2py and calls main, so you can look at the docstring in that module for more details.

···

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

BMA TRADING wrote:

1. How can I convert a large bitmap to a bitmap that is suitable (its size) for ToolBar bitmap?

unless there is a reason to do this dynamically, it probably makes sense to use any number of image manipulation tools (on Linux: xv, gimp, etc.) and make them the size you need for your app.

3. How can I include the bitmaps into my source python code?
I saw something like

def GetPlusData():

>.....

Use the img2py utility that comes with wxPython. It converts the image to a string, and makes a little wrapper function for it.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov