toolbar icon size adjustment?

I start using wxpython these days. I found it is more pretty than
pyQt.

Firstly, I followed the tutorial to build a toolbar and put one icon
on it.

toolbar = CreateToolBar()
toolbar.AddLabelTool(wx.ID_EXIT,'',wx.Bitmap('csv.png'))
toolbar.Realize()

it works.
and then I found the icon is too large, the file is 50*50.
so i add one line into the code, now it becomes

"toolbar = CreateToolBar()
toolbar.SetToolBitmapSize((16,16))
toolbar.AddLabelTool(wx.ID_EXIT,'',wx.Bitmap('csv.png'))
toolbar.Realize()"

then I try to use wx.Size(16,16). the same.

So anyone encountered such a problem. I know it is quite easy,
hopefully someone will help me to solve it. I can resize the original
png file, but I still want to get an answer.

Hi,

I start using wxpython these days. I found it is more pretty than
pyQt.

Firstly, I followed the tutorial to build a toolbar and put one icon
on it.

toolbar = CreateToolBar()
toolbar.AddLabelTool(wx.ID_EXIT,'',wx.Bitmap('csv.png'))
toolbar.Realize()

it works.
and then I found the icon is too large, the file is 50*50.
so i add one line into the code, now it becomes

"toolbar = CreateToolBar()
toolbar.SetToolBitmapSize((16,16))
toolbar.AddLabelTool(wx.ID_EXIT,'',wx.Bitmap('csv.png'))
toolbar.Realize()"

then I try to use wx.Size(16,16). the same.

So anyone encountered such a problem. I know it is quite easy,
hopefully someone will help me to solve it. I can resize the original
png file, but I still want to get an answer.

Not a 100% clear on the problem your trying to express. Are you
expecting that the toolbar will automatically resize your 50x50px
image to 16x16?

You need to either use the correct size image, or scale your image
before putting it in the toolbar. SetToolBitmapSize only sets the size
that toolbar should be expecting to display. (see
http://docs.wxwidgets.org/2.8.10/wx_wxtoolbar.html#wxtoolbarsettoolbitmapsize).

Cody

ยทยทยท

On Tue, Mar 9, 2010 at 4:09 AM, seasoul <bioseasoul@gmail.com> wrote: