Ttk Combobox widget combines a text field with a pop-down list of values.
| 666 | |
| 667 | |
| 668 | class Combobox(Entry): |
| 669 | """Ttk Combobox widget combines a text field with a pop-down list of |
| 670 | values.""" |
| 671 | |
| 672 | def __init__(self, master=None, **kw): |
| 673 | """Construct a Ttk Combobox widget with the parent master. |
| 674 | |
| 675 | STANDARD OPTIONS |
| 676 | |
| 677 | class, cursor, style, takefocus |
| 678 | |
| 679 | WIDGET-SPECIFIC OPTIONS |
| 680 | |
| 681 | exportselection, justify, height, postcommand, state, |
| 682 | textvariable, values, width |
| 683 | """ |
| 684 | Entry.__init__(self, master, "ttk::combobox", **kw) |
| 685 | |
| 686 | |
| 687 | def current(self, newindex=None): |
| 688 | """If newindex is supplied, sets the combobox value to the |
| 689 | element at position newindex in the list of values. Otherwise, |
| 690 | returns the index of the current value in the list of values |
| 691 | or -1 if the current value does not appear in the list.""" |
| 692 | if newindex is None: |
| 693 | res = self.tk.call(self._w, "current") |
| 694 | if res == '': |
| 695 | return -1 |
| 696 | return self.tk.getint(res) |
| 697 | return self.tk.call(self._w, "current", newindex) |
| 698 | |
| 699 | |
| 700 | def set(self, value): |
| 701 | """Sets the value of the combobox to value.""" |
| 702 | self.tk.call(self._w, "set", value) |
| 703 | |
| 704 | |
| 705 | class Frame(Widget): |
no outgoing calls
no test coverage detected
searching dependent graphs…