select to commands. If the selection isn't currently in
the spinbox, then a new selection is created to include
the characters between index and the most recent selection
- anchor point, inclusive. Returns an empty string.
+ anchor point, inclusive.
"""
return self.selection("adjust", index)
"""Clear the selection
If the selection isn't in this widget then the
- command has no effect. Returns an empty string.
+ command has no effect.
"""
return self.selection("clear")
"""Sets or gets the currently selected element.
If a spinbutton element is specified, it will be
- displayed depressed
+ displayed depressed.
"""
- return self.selection("element", element)
+ return self.tk.call(self._w, 'selection', 'element', element)
def selection_from(self, index):
"""Set the fixed end of a selection to INDEX."""
self.assertEqual(widget.selection_get(), '2345')
widget.selection_adjust(0)
self.assertEqual(widget.selection_get(), '12345')
- widget.selection_adjust(0)
+
+ def test_selection_element(self):
+ widget = self.create()
+ self.assertEqual(widget.selection_element(), "none")
+ widget.selection_element("buttonup")
+ self.assertEqual(widget.selection_element(), "buttonup")
+ widget.selection_element("buttondown")
+ self.assertEqual(widget.selection_element(), "buttondown")
@add_standard_options(StandardOptionsTests)