Hello All:
Is there no way to:
1. dynamically change the bitmap of a toolbar button at runtime?
2. assign a bitmap to a toolbar button from data in code (as opposed to loading from a file) using that generated by img2py.py?
Thanks in advance.
Mark
···
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
M Russo wrote:
Is there no way to:
1. dynamically change the bitmap of a toolbar button at runtime?
I'm not sure about this one
2. assign a bitmap to a toolbar button from data in code (as opposed to
loading from a file) using that generated by img2py.py?
sure is. Below is the relevant code cut and pasted from something of
mine:
def GetHandData():
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\xa0\xa9\x8c\x9e\x1e6\x19\xa0\xa8\x1e\x88\xd4C\
\x97\xd1\x83\xe8\x80
\x9c2zh\xa6\xc1\x11X\n\xab\x8c\x02\x8a\x0cD!\x92\x12\
\x98\x8c\x1e\x8a\x8b\xd1d\x14\xf4\x90%\x90LC\xf6\xbf\x1e\xba\xab\x91%\xd0\
\xdc\x86C\x06\xd9m\xe8!\xaa\x87S\x86\x1a1\xa7\x07\x00v\x0f[\x17' ))
def GetHandBitmap():
return wxBitmapFromXPMData(GetHandData())
tb.AddTool(ID_MOVE_MODE_BUTTON,
GetHandBitmap(),isToggle=true,shortHelpString = "Move")
-CHB
···
--
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
Would it suffice to use DeleteToolByPos() to remove the existing tool, then
InsertTool to insert another with the updated bitmap?
I'll leave Q2 to someone else...
regards
Steve
···
----- Original Message -----
From: "M Russo" <russomf@hotmail.com>
To: <wxpython-users@lists.wxwindows.org>
Sent: Monday, April 29, 2002 10:42 AM
Subject: [wxPython] wxToolBar and wxBitmaps
Hello All:
Is there no way to:
1. dynamically change the bitmap of a toolbar button at runtime?
--
Steve Holden: http://www.holdenweb.com/ ; Python Web Programming:
http://pydish.holdenweb.com/pwp/