Quantcast

wxNotebook: Programatically change page

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

wxNotebook: Programatically change page

Bill Papadopoulos
Greetings wxPythonians,

I got a wxNotebook with some pages added on it.

I want to change the page of the Notebook programatically.

SetSelection() may change the variable that contains the selected page but it will not actually change the page.



For some time 'till now i am parsing through the wxPython/users mailing list, searching for something similar.

A hint would be appreciated.

Regards

Vax
____________________
[hidden email]
[hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wxNotebook: Programatically change page

Thys Meintjes-4
On Tue, 2004-02-24 at 11:11, Bill Papadopoulos wrote:
> Greetings wxPythonians,
>
> I got a wxNotebook with some pages added on it.
>
> I want to change the page of the Notebook programatically.
>
> SetSelection() may change the variable that contains the selected page but it will not actually change the page.
>
>

It does. For 4 pages (0 indexed) myNoteBookInstance.SetSelection(2) wil
change the page to the 3r'd page. I use it all the time...

I'll wager you got bitten by the 0 index thing...

a example code snipped form a panel with a notebook as parent (not
necessarily good practice)

 def goLive(self):
        """
        make the message view panel the active one
        """
        self.parent.SetSelection(2)
        ....

Linux Redhat 7.2 8.0 9 Fedora Core 1, wxPython 2.4.2.4



>
> For some time 'till now i am parsing through the wxPython/users mailing list, searching for something similar.
>
> A hint would be appreciated.
>
> Regards
>
> Vax
> ____________________
> [hidden email]
[hidden email]
--
Thys Meintjes
BEng Electronic (UP), MEng Bio (UP)
Intrepid Investigator of Interesting Things
+27 82 3764 602



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wxNotebook: Programatically change page

Bill Papadopoulos
List,

thanks for responding.

I have 3 pages sucessfully added in my Notebook.

I do SetSelection(2) successfully and GetSeletion() returns me 2. This means that window indexed 2 is selected. ok so far, it works.

The problem is that the tab on the Notebook is not changed to tab 3 (zero based) although the selection is changed.

Please note that this is the way i add a Notebook page.

        self.win1 = wxWindow(self, -1, style=wxNO_3D|wxSP_3D)
        self.AddPage(self.win1,"Page1" ,True)

also note that i have tried with wxPanel

Thanks again for your time, lads.

Vax
____________________
[hidden email]
[hidden email]
  ----- Original Message -----
  From: Thys Meintjes
  To: [hidden email]
  Sent: Tuesday, February 24, 2004 11:27 AM
  Subject: Re: [wxPython-users] wxNotebook: Programatically change page


  On Tue, 2004-02-24 at 11:11, Bill Papadopoulos wrote:
  > Greetings wxPythonians,
  >
  > I got a wxNotebook with some pages added on it.
  >
  > I want to change the page of the Notebook programatically.
  >
  > SetSelection() may change the variable that contains the selected page but it will not actually change the page.
  >
  >

  It does. For 4 pages (0 indexed) myNoteBookInstance.SetSelection(2) wil
  change the page to the 3r'd page. I use it all the time...

  I'll wager you got bitten by the 0 index thing...

  a example code snipped form a panel with a notebook as parent (not
  necessarily good practice)

   def goLive(self):
          """
          make the message view panel the active one
          """
          self.parent.SetSelection(2)
  ....

  Linux Redhat 7.2 8.0 9 Fedora Core 1, wxPython 2.4.2.4



  >
  > For some time 'till now i am parsing through the wxPython/users mailing list, searching for something similar.
  >
  > A hint would be appreciated.
  >
  > Regards
  >
  > Vax
  > ____________________
  > [hidden email]
  [hidden email]
  --
  Thys Meintjes
  BEng Electronic (UP), MEng Bio (UP)
  Intrepid Investigator of Interesting Things
  +27 82 3764 602


  ---------------------------------------------------------------------
  To unsubscribe, e-mail: [hidden email]
  For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wxNotebook: Programatically change page. (Worked out)

Bill Papadopoulos
In reply to this post by Thys Meintjes-4
"...self.parent.SetSelection(2)...."

I was using the wrong instance. ThanX for your help, people.

Vax
____________________
[hidden email]
[hidden email]
  ----- Original Message -----
  From: Thys Meintjes
  To: [hidden email]
  Sent: Tuesday, February 24, 2004 11:27 AM
  Subject: Re: [wxPython-users] wxNotebook: Programatically change page


  On Tue, 2004-02-24 at 11:11, Bill Papadopoulos wrote:
  > Greetings wxPythonians,
  >
  > I got a wxNotebook with some pages added on it.
  >
  > I want to change the page of the Notebook programatically.
  >
  > SetSelection() may change the variable that contains the selected page but it will not actually change the page.
  >
  >

  It does. For 4 pages (0 indexed) myNoteBookInstance.SetSelection(2) wil
  change the page to the 3r'd page. I use it all the time...

  I'll wager you got bitten by the 0 index thing...

  a example code snipped form a panel with a notebook as parent (not
  necessarily good practice)

   def goLive(self):
          """
          make the message view panel the active one
          """
          self.parent.SetSelection(2)
  ....

  Linux Redhat 7.2 8.0 9 Fedora Core 1, wxPython 2.4.2.4



  >
  > For some time 'till now i am parsing through the wxPython/users mailing list, searching for something similar.
  >
  > A hint would be appreciated.
  >
  > Regards
  >
  > Vax
  > ____________________
  > [hidden email]
  [hidden email]
  --
  Thys Meintjes
  BEng Electronic (UP), MEng Bio (UP)
  Intrepid Investigator of Interesting Things
  +27 82 3764 602


  ---------------------------------------------------------------------
  To unsubscribe, e-mail: [hidden email]
  For additional commands, e-mail: [hidden email]
Loading...