[Q] wxPython from newbie
zeitlin at seth.lpthe.jussieu.fr
Tue Nov 13 15:37:12 CET 2001
On Mon, 12 Nov 2001 22:41:59 -0600, Young-Jin Lee <ylee12 at uiuc.edu> wrote:
> My problem is that I couldn't know the exact return type of CreateToolBar()
> method because it is a virtual function.
It returns a wxToolBar object.
> Then I got another problem in the following code.
> toolBar.AddSimpleTool( 10, images.getNewBitmap(), "New", "Long help for
> 'New'" )
> I looked up the online help, but I couldn't find any method named
> AddSimpleTool in wxToolBar and I found nothing when I tried to search
> "AddSimpleTool" in the online help.
This is a wxPython-specific method, it doesn't exist in wxWindows itself.
But it seems quite clear to me what it does: it adds a new tool (i.e. button)
to the toolbar at the position 10 (which is ignored more often than not anyhow
as toolbar usually positions its buttons itself) with the given bitmap,
tooltip and status bar help string.
> getNewBitmap() method of images.py calls getNewData() method. I guess this
> method tried to read a image file for tool bar icon.
Yes, it reads a [compressed] image embedded into the program itself.
> But I don't understand
> why we should use this kind of method. I expected there is a method whose
> input parameter is a image file name and it would return the pointer (or
> reference or whatever) of it.
There is such method in wxBitmap. But here the image is embedded right into
the program code and there is no separate file containing it.
> Is this the only way to use an image for a tool bar icon?
No, not at all. You can create the bitmap in any way you like (loading it
from file, creating it dynamically, whatever).
GCS/GM d? H+ s++:-- p2 au--- a- w+ v C+++ UBLS+++ P- L++ N++ E--- W++++ M? V--
-po+ R++ G`` !tv b+++ D--- e++++ u++ h--- f+ r++ n- y?
More information about the Python-list