wxNotebook color change

Discussion in 'Python' started by mardif, Aug 31, 2006.

  1. mardif

    mardif Guest

    Hi !

    this is my problem:

    I've a wxNotebook object, which contains 2 Panels.
    On up, there is TAB section, I have 2 tabs.
    I want to color the TAB section with ( for example ) red color.

    I've tried with SetBackgroundColour() for wxNotebook object and for 2
    panel inside, but it doesn't works.
    why??

    thx in advance!

    bye
    mardif, Aug 31, 2006
    #1
    1. Advertising

  2. mardif

    Rob Wolfe Guest

    mardif wrote:
    > Hi !
    >
    > this is my problem:
    >
    > I've a wxNotebook object, which contains 2 Panels.
    > On up, there is TAB section, I have 2 tabs.
    > I want to color the TAB section with ( for example ) red color.
    >
    > I've tried with SetBackgroundColour() for wxNotebook object and for 2
    > panel inside, but it doesn't works.
    > why??


    Presumably you forgot to refresh window. Try this:

    <code>
    import wx

    app = wx.PySimpleApp()

    frame = wx.Frame(None, -1, "Notebook")
    nb = wx.Notebook(frame, -1)
    form1 = wx.Panel(nb, -1)
    nb.AddPage(form1, "Form1")
    form2 = wx.Panel(nb, -1)
    form2.SetBackgroundColour(wx.RED)
    nb.AddPage(form2, "Form2")
    nb.SetSelection(1)
    frame.Refresh()
    frame.Show(True)

    app.MainLoop()
    </code>

    HTH,
    Rob
    Rob Wolfe, Aug 31, 2006
    #2
    1. Advertising

  3. mardif

    mardif Guest

    No no!!!
    Your example is OK, great!
    but is not my problem:

    If you set:

    frame.SetBackgroundColour(wx.RED)

    On unix, you can see that label "form1" and "form2" are grey, and
    others elements are red.
    But on Windows, on the same line of "form1" and "form2", the color is
    not red, but grey as labels.

    I want to color this space RED!!!

    Rob Wolfe wrote:
    > mardif wrote:
    > > Hi !
    > >
    > > this is my problem:
    > >
    > > I've a wxNotebook object, which contains 2 Panels.
    > > On up, there is TAB section, I have 2 tabs.
    > > I want to color the TAB section with ( for example ) red color.
    > >
    > > I've tried with SetBackgroundColour() for wxNotebook object and for 2
    > > panel inside, but it doesn't works.
    > > why??

    >
    > Presumably you forgot to refresh window. Try this:
    >
    > <code>
    > import wx
    >
    > app = wx.PySimpleApp()
    >
    > frame = wx.Frame(None, -1, "Notebook")
    > nb = wx.Notebook(frame, -1)
    > form1 = wx.Panel(nb, -1)
    > nb.AddPage(form1, "Form1")
    > form2 = wx.Panel(nb, -1)
    > form2.SetBackgroundColour(wx.RED)
    > nb.AddPage(form2, "Form2")
    > nb.SetSelection(1)
    > frame.Refresh()
    > frame.Show(True)
    >
    > app.MainLoop()
    > </code>
    >
    > HTH,
    > Rob
    mardif, Aug 31, 2006
    #3
  4. mardif

    Rob Wolfe Guest

    mardif wrote:

    > If you set:
    >
    > frame.SetBackgroundColour(wx.RED)
    >
    > On unix, you can see that label "form1" and "form2" are grey, and
    > others elements are red.
    > But on Windows, on the same line of "form1" and "form2", the color is
    > not red, but grey as labels.
    >
    > I want to color this space RED!!!


    Oh, I see now. I don't know if that is possible on windows.
    SetBackgroundColour works differently on windows than on unix,
    so probably native windows widget doesn't support this feature.
    (but I can be wrong of course.)

    Regards,
    Rob
    Rob Wolfe, Aug 31, 2006
    #4
    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. Gandalf

    wxNotebook question

    Gandalf, Jan 29, 2004, in forum: Python
    Replies:
    0
    Views:
    415
    Gandalf
    Jan 29, 2004
  2. Ray Schumacher

    Re: wxNotebook question

    Ray Schumacher, Jan 29, 2004, in forum: Python
    Replies:
    0
    Views:
    532
    Ray Schumacher
    Jan 29, 2004
  3. Gandalf

    Re: wxNotebook question

    Gandalf, Jan 30, 2004, in forum: Python
    Replies:
    0
    Views:
    462
    Gandalf
    Jan 30, 2004
  4. Replies:
    1
    Views:
    582
  5. Replies:
    4
    Views:
    456
    F. GEIGER
    Mar 21, 2005
Loading...

Share This Page