title: Python: Referring to single labels in a Pmw RadioSelect
body: <p>I would like to create a hover box (or info box) which opens up when the user places the mouse cursor on top of a Pmw RadioSelect <em>label</em>. For example, when the cursor is placed on top of &quot;Primary&quot; the program opens an info box explaining what &quot;Primary&quot; means.</p>
  <p><a href="https://i.stack.imgur.com/HvJ0n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HvJ0n.png" alt="Pic 1, Pmw RadioSelect" /></a></p>
  <p>Problem: I don't know how to access the individual labels <em>inside</em> the RadioSelect object. I need to bind a method to the individual labels, but I don't know how to refer to them.</p>
  <p>Extra: How could I have solved this myself? I tried looking at the RadioSelect attributes with dir() and I read the Pmw manual online, but couldn't find the information.</p>
  <p><strong>EDIT</strong> This is what I have found out thus far: The <a href="http://pmw.sourceforge.net/doc/RadioSelect.html" rel="nofollow noreferrer">manual</a> says that the labels only start to exist if their position is set explicitly:</p>
  <blockquote>
  <p><strong>labelpos</strong></p>
  <p>Initialisation option. Specifies where to place the label component.</p>
  <p>If <strong>None</strong>, a label component is not created. The default is <strong>None</strong></p>
  </blockquote>
  <p>After setting it explicitly for example as so:</p>
  <pre><code>self.rs = Pmw.RadioSelect(parent, labelpos = 'w')
  </code></pre>
  <p>you can refer to it with
  self.rs.component('label')</p>
  <p>But I still don't know how to reach the individual labels.</p>
  <p><strong>EDIT 2:</strong> The trick was just to assign the RadioSelect &quot;items&quot; into variables like the accepted answer suggests:</p>
  <pre><code>self.cb1 = self.radio_select.add(&quot;text&quot;)
  </code></pre>
  <p>After assigning the &quot;item&quot; into a variable you can simply bind methods to the variable, like such:</p>
  <pre><code>self.balloon = Pmw.Balloon(self, initwait=500, relmouse='both')
  self.balloon.bind(self.cb1, &quot;Balloon text example&quot;)
  </code></pre>