notebook in Glade



In glade, notebook has three tabs with three labels named label1, 2, 3.
so, we call it and only page3 is displayed.

I can't minus tab num in glade or make page1 display at first, so, how
to ?

thanks

notebook.py

#!/usr/bin/env python
#coding=utf8

import sys
import gtk

class Notebook:
        def __init__(self, fname):
                self.builder = gtk.Builder()
                self.builder.add_from_file(fname)
               
                self.window = self.builder.get_object('window1')
                self.window.set_size_request(400, 300)

                if self.window :
                        self.window.connect('destroy', self.quit)

                self.notebook = self.builder.get_object('notebook1')
                self.label1 = self.builder.get_object('label1')
                self.label2 = self.builder.get_object('label2')
                self.label3 = self.builder.get_object('label3')

                self.builder.connect_signals(self)
                return

        def main(self):
                self.window.show()
                gtk.main()
                return

        def quit(self, *args):
                gtk.main_quit()

if __name__ == '__main__':
        if len(sys.argv) > 1:
                fname = sys.argv[1]
        else:
                fname = '/home/zombo/Desktop/notebook.glade'

        notebook = Notebook(fname)
        notebook.main()



notebook.glade

<?xml version="1.0"?>
<interface>
  <requires lib="gtk+" version="2.16"/>
  <!-- interface-naming-policy project-wide -->
  <object class="GtkWindow" id="window1">
    <child>
      <object class="GtkNotebook" id="notebook1">
        <property name="visible">True</property>
        <property name="can_focus">True</property>
        <child>
          <object class="GtkTextView" id="textview1">
            <property name="width_request">100</property>
            <property name="height_request">0</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
          </object>
        </child>
        <child type="tab">
          <object class="GtkLabel" id="label1">
            <property name="visible">True</property>
            <property name="label" translatable="yes">page 1</property>
          </object>
          <packing>
            <property name="tab_fill">False</property>
          </packing>
        </child>
        <child>
          <placeholder/>
        </child>
        <child type="tab">
          <object class="GtkLabel" id="label2">
            <property name="visible">True</property>
            <property name="label" translatable="yes">page 2</property>
          </object>
          <packing>
            <property name="position">1</property>
            <property name="tab_fill">False</property>
          </packing>
        </child>
        <child>
          <placeholder/>
        </child>
        <child type="tab">
          <object class="GtkLabel" id="label3">
            <property name="visible">True</property>
            <property name="label" translatable="yes">page 3</property>
          </object>
          <packing>
            <property name="position">2</property>
            <property name="tab_fill">False</property>
          </packing>
        </child>
      </object>
    </child>
  </object>
</interface>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]