Vertical tab text in wxNotebook

490 views
Skip to first unread message

Ramashish Baranwal

unread,
Feb 11, 2008, 2:04:20 PM2/11/08
to wx-u...@lists.wxwidgets.org
Hi,

I am using wxPython and want to create a wx.Notebook with tabs on left
side, but with vertical tab text orientation. I have found that the
tabs can be put on left side by specifying wx.NB_LEFT as style. How
can I (if possible) make the orientation of tab title text vertical
instead of horizontal?

Thanks,
Ram

Robin Dunn

unread,
Feb 11, 2008, 4:01:44 PM2/11/08
to wx-u...@lists.wxwidgets.org

Doesn't it do that by default? Which platform are you on? Which
version of wxPython?


--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!


Ramashish Baranwal

unread,
Feb 12, 2008, 1:26:30 AM2/12/08
to wx-u...@lists.wxwidgets.org
> > Hi,
> >
> > I am using wxPython and want to create a wx.Notebook with tabs on left
> > side, but with vertical tab text orientation. I have found that the
> > tabs can be put on left side by specifying wx.NB_LEFT as style. How
> > can I (if possible) make the orientation of tab title text vertical
> > instead of horizontal?
>
> Doesn't it do that by default? Which platform are you on? Which
> version of wxPython?
>
No, it doesn't. Here is my sample code-

class MyPage(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
t = wx.StaticText(self, -1, "This is a Page object", (20,20))

class MainFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="Simple Notebook Example")

# Here we create a panel and a notebook on the panel
p = wx.Panel(self)
nb = wx.Notebook(p, style=wx.NB_LEFT)

# create the page windows as children of the notebook
page1 = MyPage(nb)
page2 = MyPage(nb)
page3 = MyPage(nb)

# add the pages to the notebook with the label to show on the tab
nb.AddPage(page1, "Page 1")
nb.AddPage(page2, "Page 2")
nb.AddPage(page3, "Page 3")

# finally, put the notebook in a sizer for the panel to manage
# the layout
sizer = wx.BoxSizer()
sizer.Add(nb, 1, wx.EXPAND)
p.SetSizer(sizer)

The tab title texts are shown on left side but with horizontal orientation e.g.-

Page 1
---------
Page 2
---------
Page 3

I am on Linux (Fedora 7), with wxPython version 2.8.4.0.

Thanks,
Ram

Robin Dunn

unread,
Feb 12, 2008, 7:16:43 PM2/12/08
to wx-u...@lists.wxwidgets.org
Ramashish Baranwal wrote:
>>> Hi,
>>>
>>> I am using wxPython and want to create a wx.Notebook with tabs on left
>>> side, but with vertical tab text orientation. I have found that the
>>> tabs can be put on left side by specifying wx.NB_LEFT as style. How
>>> can I (if possible) make the orientation of tab title text vertical
>>> instead of horizontal?
>> Doesn't it do that by default? Which platform are you on? Which
>> version of wxPython?
>>
> No, it doesn't. Here is my sample code-
>

>

> I am on Linux (Fedora 7), with wxPython version 2.8.4.0.

It looks to be a limitation of GTK+, I don't see anything in the gtk
notebook api functions for setting tab orientation. wx could probably
be made to support it by setting the angle used for the label widgets on
the tabs, but that would need a patch and some testing, it's not just
something that can be turned on easily.

Reply all
Reply to author
Forward
0 new messages