468,115 Members | 2,021 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,115 developers. It's quick & easy.

PythonWin dynamic toolbar

Hi All,
I'm trying to create a dynamic toolbar.
This function tries to create the toolbar and add a button to it.
It craches at tbctrl.SteBitmapSize(32,32)

What is wrong with it?

Thank you,
Lale
def OnCreateClient(self,context,obj):
window.MDIChildWnd.OnCreateClient(self,context,obj )
parent = self
style = win32con.WS_CHILD | win32con.WS_VISIBLE |
afxres.CBRS_SIZE_DYNAMIC | afxres.CBRS_TOP | \
afxres.CBRS_TOOLTIPS | afxres.CBRS_FLYBY
self.toolbar = tb = win32ui.CreateToolBar (parent, style)
tbctrl = tb.GetToolBarCtrl()
tbctrl.SetBitmapSize(32,32)
bmp = win32ui.CreateBitmap()
bmp.LoadBitmapFile(open('importimages.bmp','r'))
bmpIndex = tbctrl.AddBitmap(1,bmp)
tbctrl.AddStrings('rect\0point\0poligon\0')
tbutton = tbctrl.TBUTTON
tbutton[0]=(bmpIndex,868,win32con.TBSTATE_ENABLED,
win32con.TBSTYLE_BUTTON,None,0)
tbctrl.AddButtons(1,tbutton)
tb.EnableDocking(afxres.CBRS_ALIGN_ANY)
tb.SetWindowText("Test")
parent.EnableDocking(afxres.CBRS_ALIGN_ANY)
parent.DockControlBar(tb)
print tbctrl.GetButtonCount()
return 1

Jul 18 '05 #1
0 1310

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Martin Bless | last post: by
14 posts views Thread by Jive | last post: by
3 posts views Thread by Nancy | last post: by
reply views Thread by Hertha Steck | last post: by
3 posts views Thread by archaegeo | last post: by
reply views Thread by nbancajas | last post: by
4 posts views Thread by sterling | last post: by
5 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.