Hi,
I'm a real newby at using wxPython, so if I'm asking anything that should be obvious, please forgive me. In the code at the bottom, I'm creating a frame with a NotebookCtrl and three pages. The colored tabs and tab text are larger and bolder than normal (in the eventual application, the tabs will be changing color up to 3 times/second), and there will be additional notebooks on each page). I started with code generated by wxGlade, rearranged the code a bit so I could see what was it was doing, then substituted the NotebookCtrl object for the Notebook and added some of its functionality. It's not doing all that I'd like. I've looked through the NotebookCtrl demo but still have the following questions/problems:
1) As the tab text gets larger than the default, it is not vertically centered. Is there a way to do this?
2) My tool tip string does not show, making me think I've not implemented it correctly.
3) I would like the focus and currently selected tab to be clearer (like the brown line above the tabs that appear in demo program). The SetHighlightSelection and SetSelectionColour methods aren't having any effect.
4) Is there a way to make the tab shapes different, such as having rounded corners?
I would very much appreciate any assistance.
Chris
···
-----------------------------------------
import wx
import NotebookCtrl as NC
class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.SetTitle("MyFrame")
# Instantiate Station Notebook and tabs.
# Make its parent the top frame.
# Assign pages to the notebook.
self.station_nb = NC.NotebookCtrl(self, -1)
self.station_nb_tab_S1 = wx.Panel(self.station_nb, -1)
self.station_nb_tab_S2 = wx.Panel(self.station_nb, -1)
self.station_nb_tab_S3 = wx.Panel(self.station_nb, -1)
# Set Station Notebook properties
self.station_nb.SetMinSize((512,256))
self.station_nb.SetToolTipString("View FRONT Station results")
self.station_nb.SetHighlightSelection(True)
self.station_nb.SetSelectionColour(wx.NamedColor("Brown"))
self.station_nb.SetUseFocusIndicator(True)
# Add pages to Station Notebook
self.station_nb.AddPage(self.station_nb_tab_S1, " S1: Color ")
self.station_nb.AddPage(self.station_nb_tab_S2, " S2: UV ")
self.station_nb.AddPage(self.station_nb_tab_S3, " S3: Color ")
# Color the tabs
self.station_nb.SetPageColour(0, wx.RED)
self.station_nb.SetPageColour(1, wx.NamedColor("Yellow"))
self.station_nb.SetPageColour(2, wx.GREEN)
# Set the tab fonts
self.station_nb.SetPageTextFont(0, wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL, 0, "Arial Black"))
self.station_nb.SetPageTextFont(1, wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL, 0, "Arial Black"))
self.station_nb.SetPageTextFont(2, wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL, 0, "Arial Black"))
# Make a sizer and add to the frame
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_1.Add(self.station_nb)
self.SetAutoLayout(True)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
sizer_1.SetSizeHints(self)
self.Layout()
# end of class MyFrame
if __name__ == "__main__":
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
frame_1 = MyFrame(None, -1, "")
app.SetTopWindow(frame_1)
frame_1.Show()
# frame_1.ShowFullScreen(True)
app.MainLoop()