PythonWin dynamic toolbar

Discussion in 'Python' started by Ilariu Raducan, Jul 7, 2003.

  1. 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
    Ilariu Raducan, Jul 7, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Richard Lee
    Replies:
    2
    Views:
    422
    Daniel Dittmar
    Jul 22, 2003
  2. Adam
    Replies:
    0
    Views:
    324
  3. stephan
    Replies:
    0
    Views:
    422
    stephan
    Jul 30, 2003
  4. Martin Bless

    Detect PythonWin?

    Martin Bless, Aug 1, 2003, in forum: Python
    Replies:
    7
    Views:
    352
    Roger Upole
    Aug 2, 2003
  5. pcouas
    Replies:
    0
    Views:
    233
    pcouas
    Feb 19, 2007
Loading...

Share This Page