简体   繁体   中英

AUINoteBook on wxpython 2.9 With Icons

I'm trying to ensure that the program that I'm writing with wxpython is supporting the development versions as well as the stable one, mainly because of many cosmetic improvements not back-ported to the stable branch.
I have a AUINoteBook window in my program, and today I added icons to the tabs.
However, when I try this in 2.9, I get this error:

Traceback (most recent call last):
  ...
  File "...", line 91, in _NewPage
    self.noteBook.AddPage(Window, Caption, bitmap=bitmap)
  File "/home/roy/wx2.9/wxPython-src-2.9.4.0/wxPython/wx/_core.py", line 13628, in AddPage
    return _core_.BookCtrlBase_AddPage(*args, **kwargs)
TypeError: 'bitmap' is an invalid keyword argument for this function

Any idea what is the new API to add icon to the tab?

Looking at the code, it appears to be proxying the wx.Notebook or wx.BookCtrl code, so I'm guessing you'll have to use the same API that wx.Notebook uses, which is using a wx.ImageList and then adding it to the notebook using myNotebook.SetPageImage(pageNumber, imageNumber)

The wxPython demo shows how to do this in the wx.Notebook demo.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM