python glade notebook tabs won't switch

27 Views Asked by At

I'm working on a glade python project. I'm using Gtk 3, and I have a notebook widget with several tabs. I cannot get the tabs to work. I double click on a tab and the interface does nothing. What I can do is hit the tab key until the notebook tab is highlighted and then use the arrow keys. I believe it should work if I just double click it. Enclosed is some of my glade file.

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Generated with glade 3.40.0 -->
    <interface>
      <requires lib="gtk+" version="3.24"/>
      <object class="GtkWindow" id="corpus-top">
        <property name="can-focus">False</property>
        <child>
          <!-- n-columns=1 n-rows=2 -->
          <object class="GtkGrid" id="grid">
            <property name="visible">True</property>
            <property name="can-focus">False</property>
            <property name="hexpand">True</property>
            <property name="vexpand">True</property>
            <child>
              <object class="GtkNotebook" id="notebook">
                <property name="visible">True</property>
                <property name="can-focus">True</property>
                <property name="hexpand">True</property>
                <property name="vexpand">True</property>
                <property name="scrollable">True</property>
                <child>
                  <!-- n-columns=1 n-rows=5 -->
                  <object class="GtkGrid" id="grid-sources">
                    <property name="visible">True</property>
                    <property name="can-focus">False</property>
                    <property name="vexpand">True</property>
                    <property name="orientation">vertical</property>
                    <child>
                      <object class="GtkTextView" id="text-sources">
                        <property name="visible">True</property>
                        <property name="can-focus">True</property>
                        <property name="hexpand">True</property>
                        <property name="vexpand">True</property>
                        <property name="editable">False</property>
                        <property name="justification">fill</property>
                        <property name="input-purpose">alpha</property>
                        <property name="monospace">True</property>
                      </object>
                      <packing>
                        <property name="left-attach">0</property>
                        <property name="top-attach">0</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkButton" id="button-add">
                        <property name="label" translatable="yes">add source</property>
                        <property name="visible">True</property>
                        <property name="can-focus">True</property>
                        <property name="receives-default">True</property>
                      </object>
                      <packing>
                        <property name="left-attach">0</property>
                        <property name="top-attach">1</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkButton" id="button-finish">
                        <property name="label" translatable="yes">finish</property>
                        <property name="visible">True</property>
                        <property name="can-focus">True</property>
                        <property name="receives-default">True</property>
                      </object>
                      <packing>
                        <property name="left-attach">0</property>
                        <property name="top-attach">2</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkButton" id="button-associate">
                        <property name="label" translatable="yes">associate</property>
                        <property name="visible">True</property>
                        <property name="can-focus">True</property>
                        <property name="receives-default">True</property>
                      </object>
                      <packing>
                        <property name="left-attach">0</property>
                        <property name="top-attach">3</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkButton" id="button-remove">
                        <property name="label" translatable="yes">remove</property>
                        <property name="visible">True</property>
                        <property name="can-focus">True</property>
                        <property name="receives-default">True</property>
                      </object>
                      <packing>
                        <property name="left-attach">0</property>
                        <property name="top-attach">4</property>
                      </packing>
                    </child>
                  </object>
                </child>
                <child type="tab">
                  <object class="GtkLabel" id="label-sources">
                    <property name="visible">True</property>
                    <property name="can-focus">False</property>
                    <property name="label" translatable="yes">sources</property>
                    <property name="selectable">True</property>
                  </object>
                  <packing>
                    <property name="tab-fill">False</property>
                  </packing>
                </child>
                <child>
                  <!-- n-columns=1 n-rows=3 -->
                  <object class="GtkGrid" id="grid-preview">
                    <property name="visible">True</property>
                    <property name="can-focus">False</property>
                    <property name="vexpand">True</property>
                    <child>
                      <object class="GtkTextView" id="text-preview">
                        <property name="visible">True</property>
                        <property name="can-focus">True</property>
                        <property name="hexpand">True</property>
                        <property name="vexpand">True</property>
                        <property name="editable">False</property>
                        <property name="accepts-tab">False</property>
                        <property name="monospace">True</property>
                      </object>
                      <packing>
                        <property name="left-attach">0</property>
                        <property name="top-attach">0</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkButton" id="button-preview">
                        <property name="label" translatable="yes">select preview</property>
                        <property name="visible">True</property>
                        <property name="can-focus">True</property>
                        <property name="receives-default">True</property>
                      </object>
                      <packing>
                        <property name="left-attach">0</property>
                        <property name="top-attach">1</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkButton" id="button-show">
                        <property name="label" translatable="yes">show</property>
                        <property name="visible">True</property>
                        <property name="can-focus">True</property>
                        <property name="receives-default">True</property>
                      </object>
                      <packing>
                        <property name="left-attach">0</property>
                        <property name="top-attach">2</property>
                      </packing>
                    </child>
                  </object>
                  <packing>
                    <property name="position">1</property>
                  </packing>
                </child>
                <child type="tab">
                  <object class="GtkLabel" id="label-preview">
                    <property name="visible">True</property>
                    <property name="can-focus">False</property>
                    <property name="label" translatable="yes">preview</property>
                    <property name="selectable">True</property>
                  </object>
                  <packing>
                    <property name="position">1</property>
                    <property name="tab-fill">False</property>
                  </packing>
                </child>
                <child>
                  <!-- n-columns=1 n-rows=5 -->
                  <object class="GtkGrid" id="grid-output">
                    <property name="visible">True</property>
                    <property name="can-focus">False</property>
                    <property name="vexpand">True</property>
                    <child>
                      <object class="GtkButton" id="button-write">
                        <property name="label" translatable="yes">write</property>
                        <property name="visible">True</property>
                        <property name="can-focus">True</property>
                        <property name="receives-default">True</property>
                        <property name="hexpand">True</property>
                      </object>
                      <packing>
                        <property name="left-attach">0</property>
                        <property name="top-attach">0</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkButton" id="button-spaces">
                        <property name="label" translatable="yes">spaces for tokenizer</property>
                        <property name="visible">True</property>
                        <property name="can-focus">True</property>
                        <property name="receives-default">True</property>
                      </object>
                      <packing>
                        <property name="left-attach">0</property>
                        <property name="top-attach">1</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkButton" id="button-prompt-edit">
                        <property name="label" translatable="yes">prompt edit</property>
                        <property name="visible">True</property>
                        <property name="can-focus">True</property>
                        <property name="receives-default">True</property>
                      </object>
                      <packing>
                        <property name="left-attach">0</property>
                        <property name="top-attach">2</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkLabel" id="label-status">
                        <property name="visible">True</property>
                        <property name="can-focus">False</property>
                        <property name="hexpand">True</property>
                        <property name="label" translatable="yes">option status:</property>
                        <attributes>
                          <attribute name="background" value="#f8f8e4e45c5c"/>
                        </attributes>
                      </object>
                      <packing>
                        <property name="left-attach">0</property>
                        <property name="top-attach">3</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkBox" id="grid-spacer-1">
                        <property name="visible">True</property>
                        <property name="can-focus">False</property>
                        <property name="vexpand">True</property>
                        <property name="orientation">vertical</property>
                        <child>
                          <placeholder/>
                        </child>
                        <child>
                          <object class="GtkLabel" id="label-mix">
                            <property name="visible">True</property>
                            <property name="can-focus">False</property>
                            <property name="label" translatable="yes">mix info</property>
                            <attributes>
                              <attribute name="background" value="#9999c1c1f1f1"/>
                            </attributes>
                          </object>
                          <packing>
                            <property name="expand">False</property>
                            <property name="fill">True</property>
                            <property name="position">2</property>
                          </packing>
                        </child>
                      </object>
                      <packing>
                        <property name="left-attach">0</property>
                        <property name="top-attach">4</property>
                      </packing>
                    </child>
                  </object>
                  <packing>
                    <property name="position">2</property>
                  </packing>
                </child>
                <child type="tab">
                  <object class="GtkLabel" id="label-output">
                    <property name="visible">True</property>
                    <property name="can-focus">False</property>
                    <property name="label" translatable="yes">output</property>
                    <property name="selectable">True</property>
                  </object>
                  <packing>
                    <property name="position">2</property>
                    <property name="tab-fill">False</property>
                  </packing>
                </child>
                <child>
                  <!-- n-columns=3 n-rows=3 -->
                  <object class="GtkGrid" id="grid-compose">
                    <property name="visible">True</property>
                    <property name="can-focus">False</property>
                    <child>
                      <object class="GtkButton">
                        <property name="label" translatable="yes">save</property>
                        <property name="visible">True</property>
                        <property name="can-focus">True</property>
                        <property name="receives-default">True</property>
                      </object>
                      <packing>
                        <property name="left-attach">2</property>
                        <property name="top-attach">2</property>
                      </packing>
                    </child>
                    <child>
                      <placeholder/>
                    </child>
                    <child>
                      <placeholder/>
                    </child>
                    <child>
                      <placeholder/>
                    </child>
                    <child>
                      <placeholder/>
                    </child>
                    <child>
                      <placeholder/>
                    </child>
                    <child>
                      <placeholder/>
                    </child>
                    <child>
                      <placeholder/>
                    </child>
                    <child>
                      <placeholder/>
                    </child>
                  </object>
                  <packing>
                    <property name="position">3</property>
                  </packing>
                </child>
                <child type="tab">
                  <object class="GtkLabel" id="label-compose">
                    <property name="visible">True</property>
                    <property name="can-focus">False</property>
                    <property name="label" translatable="yes">compose dots</property>
                  </object>
                  <packing>
                    <property name="position">3</property>
                    <property name="tab-fill">False</property>
                  </packing>
                </child>
              </object>
              <packing>
                <property name="left-attach">0</property>
                <property name="top-attach">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkMenuBar" id="menu-bar">
                <property name="visible">True</property>
                <property name="can-focus">False</property>
                <child>
                  <object class="GtkMenuItem">
                    <property name="visible">True</property>
                    <property name="can-focus">False</property>
                    <property name="label" translatable="yes">_File</property>
                    <property name="use-underline">True</property>
                    <child type="submenu">
                      <object class="GtkMenu">
                        <property name="visible">True</property>
                        <property name="can-focus">False</property>
                        <child>
                          <object class="GtkImageMenuItem" id="menu-file-new">
                            <property name="label">gtk-new</property>
                            <property name="visible">True</property>
                            <property name="can-focus">False</property>
                            <property name="use-underline">True</property>
                            <property name="use-stock">True</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkImageMenuItem" id="menu-file-open">
                            <property name="label">gtk-open</property>
                            <property name="visible">True</property>
                            <property name="can-focus">False</property>
                            <property name="use-underline">True</property>
                            <property name="use-stock">True</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkImageMenuItem" id="menu-file-save">
                            <property name="label">gtk-save</property>
                            <property name="visible">True</property>
                            <property name="can-focus">False</property>
                            <property name="use-underline">True</property>
                            <property name="use-stock">True</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkSeparatorMenuItem">
                            <property name="visible">True</property>
                            <property name="can-focus">False</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkImageMenuItem" id="menu-file-quit">
                            <property name="label">gtk-quit</property>
                            <property name="visible">True</property>
                            <property name="can-focus">False</property>
                            <property name="use-underline">True</property>
                            <property name="use-stock">True</property>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                </child>
                <child>
                  <object class="GtkMenuItem">
                    <property name="visible">True</property>
                    <property name="can-focus">False</property>
                    <property name="label" translatable="yes">_Help</property>
                    <property name="use-underline">True</property>
                    <child type="submenu">
                      <object class="GtkMenu" id="menu-help-about">
                        <property name="visible">True</property>
                        <property name="can-focus">False</property>
                        <child>
                          <object class="GtkImageMenuItem">
                            <property name="label">gtk-about</property>
                            <property name="visible">True</property>
                            <property name="can-focus">False</property>
                            <property name="use-underline">True</property>
                            <property name="use-stock">True</property>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left-attach">0</property>
                <property name="top-attach">0</property>
              </packing>
            </child>
          </object>
        </child>
      </object>
    </interface>
1

There are 1 best solutions below

0
D Liebman On

so, I went back to the glade editing gui and edited the labels on the notebook tabs. They had been set to selectable. This meant when you cliked on them the text in the label was highlighted, but the click was not transmitted to the tab for the notebook itself. I changed all the labels to not-focusable or not-selectable, and the tabs work. Now the tab is selected with one click.