This file is indexed.

/usr/share/doc/python-gtk2-tutorial/html/sec-RadioButtons.html is in python-gtk2-tutorial 2.4-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>6.4. Radio Buttons</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Tutorial"><link rel="up" href="ch-ButtonWidget.html" title="Chapter 6. The Button Widget"><link rel="previous" href="sec-CheckButtons.html" title="6.3. Check Buttons"><link rel="next" href="ch-Adjustments.html" title="Chapter 7. Adjustments"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">6.4. Radio Buttons</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-CheckButtons.html">Prev</a> </td><th width="60%" align="center">Chapter 6. The Button Widget</th><td width="20%" align="right"> <a accesskey="n" href="ch-Adjustments.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec-RadioButtons"></a>6.4. Radio Buttons</h2></div></div><div></div></div><p>Radio buttons are similar to check buttons except they are grouped
so that only one may be selected/depressed at a time. This is good for
places in your application where you need to select from a short list of
options.</p><p>Creating a new radio button is done with this call:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  radio_button = gtk.RadioButton(<b class="parameter"><tt>group</tt></b>=None, <b class="parameter"><tt>label</tt></b>=None)
</pre></td></tr></table><p>You'll notice the extra argument to this call. Radio buttons
require a <i class="parameter"><tt>group</tt></i> to operate properly. The first call
to <tt class="function">gtk.RadioButton</tt>() should pass
<tt class="literal">None</tt> as the first argument and a new radio button group
will be created with the new radio button as its only member.</p><p>To add more radio buttons to a group, pass in a reference to a
radio button in <i class="parameter"><tt>group</tt></i> in subsequent calls to
<tt class="function">gtk.RadioButton</tt>().</p><p>If a <i class="parameter"><tt>label</tt></i> argument is specified the text
will be parsed for '_'-prefixed mnemonic characters.</p><p>It is also a good idea to explicitly set which button should be
the default depressed button with:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  radio_button.set_active(<b class="parameter"><tt>is_active</tt></b>)
</pre></td></tr></table><p>This is described in the section on toggle buttons, and works in
exactly the same way. Once the radio buttons are grouped together, only one
of the group may be active at a time. If the user clicks on one radio
button, and then on another, the first radio button will first emit a
"toggled" signal (to report becoming inactive), and then the second will
emit its "toggled" signal (to report becoming active).</p><p>The example program <a href="examples/radiobuttons.py" target="_top"><span><b class="command">radiobuttons.py</b></span></a>
creates a radio button group with three buttons.
<a href="sec-RadioButtons.html#radiobuttonfig" title="Figure 6.4. Radio Buttons Example">Figure 6.4, &#8220;Radio Buttons Example&#8221;</a> illustrates the resulting window:</p><div class="figure"><a name="radiobuttonfig"></a><p class="title"><b>Figure 6.4. Radio Buttons Example</b></p><div class="mediaobject" align="center"><img src="figures/radiobutton.png" align="middle" alt="Radio Buttons Example"></div></div><p>The source code for the example program is:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
    1	#!/usr/bin/env python
    2	
    3	# example radiobuttons.py
    4	
    5	import pygtk
    6	pygtk.require('2.0')
    7	import gtk
    8	
    9	class RadioButtons:
   10	    def callback(self, widget, data=None):
   11	        print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
   12	
   13	    def close_application(self, widget, event, data=None):
   14	        gtk.main_quit()
   15	        return False
   16	
   17	    def __init__(self):
   18	        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
   19	  
   20	        self.window.connect("delete_event", self.close_application)
   21	
   22	        self.window.set_title("radio buttons")
   23	        self.window.set_border_width(0)
   24	
   25	        box1 = gtk.VBox(False, 0)
   26	        self.window.add(box1)
   27	        box1.show()
   28	
   29	        box2 = gtk.VBox(False, 10)
   30	        box2.set_border_width(10)
   31	        box1.pack_start(box2, True, True, 0)
   32	        box2.show()
   33	
   34	        button = gtk.RadioButton(None, "radio button1")
   35	        button.connect("toggled", self.callback, "radio button 1")
   36	        box2.pack_start(button, True, True, 0)
   37	        button.show()
   38	
   39	        button = gtk.RadioButton(button, "radio button2")
   40	        button.connect("toggled", self.callback, "radio button 2")
   41	        button.set_active(True)
   42	        box2.pack_start(button, True, True, 0)
   43	        button.show()
   44	
   45	        button = gtk.RadioButton(button, "radio button3")
   46	        button.connect("toggled", self.callback, "radio button 3")
   47	        box2.pack_start(button, True, True, 0)
   48	        button.show()
   49	
   50	        separator = gtk.HSeparator()
   51	        box1.pack_start(separator, False, True, 0)
   52	        separator.show()
   53	
   54	        box2 = gtk.VBox(False, 10)
   55	        box2.set_border_width(10)
   56	        box1.pack_start(box2, False, True, 0)
   57	        box2.show()
   58	
   59	        button = gtk.Button("close")
   60	        button.connect_object("clicked", self.close_application, self.window,
   61	                              None)
   62	        box2.pack_start(button, True, True, 0)
   63	        button.set_flags(gtk.CAN_DEFAULT)
   64	        button.grab_default()
   65	        button.show()
   66	        self.window.show()
   67	
   68	def main():
   69	    gtk.main()
   70	    return 0        
   71	
   72	if __name__ == "__main__":
   73	    RadioButtons()
   74	    main()
</pre></td></tr></table><p>The code is fairly straight forward. Lines 63-64 make the
"close" button the default widget so that pressing the "Enter" key when the
window is active causes the "close" button to emit the "clicked"
signal.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-CheckButtons.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch-ButtonWidget.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch-Adjustments.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">6.3. Check Buttons </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 7. Adjustments</td></tr></table></div></body></html>