In the following sample program I can’t seem to get the notebook control to use the styles I tell it to use. Despite the FNB_HIDE_ON_SINGLE_TAB, FNB_NO_NAV_BUTTONS and FNB_X_ON_TABS styles I still see the navigation buttons and a single tab with no close button. It’s the same for all styles I’ve tried, they’re all completely ignored.
I’m running this on Ubuntu 11.10, python 2.7.2 and wxPython 2.8.11 if it matters
import wx
import wx.lib.flatnotebook as FNB
class TabCtrl(FNB.FlatNotebook):
def __init__(self, parent):
windowstyle = FNB.FNB_HIDE_ON_SINGLE_TAB|FNB.FNB_NO_NAV_BUTTONS|FNB.FNB_X_ON_TAB
super(TabCtrl, self).__init__(parent, style=windowstyle)
self.pages = []
self.pages.append(wx.Panel(self))
self.AddPage(self.pages[0], 'Test')
class MainFrame(wx.Frame):
def __init__(self, *args, **kwargs):
super(MainFrame, self).__init__(*args, **kwargs)
self.panel = wx.Panel(self)
self.tabs = TabCtrl(self.panel)
sizer = wx.GridBagSizer(vgap=8, hgap=8)
sizer.Add(self.tabs, (0, 0), (10, 30), wx.EXPAND)
sizer.AddGrowableCol(29)
sizer.AddGrowableRow(9)
self.panel.SetSizer(sizer)
self.panel.Fit()
self.SetInitialSize()
class App(wx.App):
def __init__(self, *args, **kwargs):
super(App, self).__init__(*args, **kwargs)
self.frame = MainFrame(None, title='Test')
self.frame.Show()
app = App()
app.MainLoop()
FNB_NO_NAV_BUTTONS and FNB_X_ON_TABS both work on my machine (using the wxPython demo) using wxPython 2.8.12, Windows 7, Python 2.6. When it comes to anything in the AGW widget set, I highly recommend downloading the latest version from SVN. I know the author of that library and he’s always updating it and fixing bugs, so updating to the latest in SVN is usually worth it.
EDIT: I was looking at this again and I think you’re putting at least some of those flags in on the wrong parameter. There’s an “agwStyle” argument in FlatNotebook too and I’m thinking that’s where some or all of those FlatNotebook-related flags should be applied to: