Button widget.
| 2701 | |
| 2702 | |
| 2703 | class Button(Widget): |
| 2704 | """Button widget.""" |
| 2705 | |
| 2706 | def __init__(self, master=None, cnf={}, **kw): |
| 2707 | """Construct a button widget with the parent MASTER. |
| 2708 | |
| 2709 | STANDARD OPTIONS |
| 2710 | |
| 2711 | activebackground, activeforeground, anchor, |
| 2712 | background, bitmap, borderwidth, cursor, |
| 2713 | disabledforeground, font, foreground |
| 2714 | highlightbackground, highlightcolor, |
| 2715 | highlightthickness, image, justify, |
| 2716 | padx, pady, relief, repeatdelay, |
| 2717 | repeatinterval, takefocus, text, |
| 2718 | textvariable, underline, wraplength |
| 2719 | |
| 2720 | WIDGET-SPECIFIC OPTIONS |
| 2721 | |
| 2722 | command, compound, default, height, |
| 2723 | overrelief, state, width |
| 2724 | """ |
| 2725 | Widget.__init__(self, master, 'button', cnf, kw) |
| 2726 | |
| 2727 | def flash(self): |
| 2728 | """Flash the button. |
| 2729 | |
| 2730 | This is accomplished by redisplaying |
| 2731 | the button several times, alternating between active and |
| 2732 | normal colors. At the end of the flash the button is left |
| 2733 | in the same normal/active state as when the command was |
| 2734 | invoked. This command is ignored if the button's state is |
| 2735 | disabled. |
| 2736 | """ |
| 2737 | self.tk.call(self._w, 'flash') |
| 2738 | |
| 2739 | def invoke(self): |
| 2740 | """Invoke the command associated with the button. |
| 2741 | |
| 2742 | The return value is the return value from the command, |
| 2743 | or an empty string if there is no command associated with |
| 2744 | the button. This command is ignored if the button's state |
| 2745 | is disabled. |
| 2746 | """ |
| 2747 | return self.tk.call(self._w, 'invoke') |
| 2748 | |
| 2749 | |
| 2750 | class Canvas(Widget, XView, YView): |