The gtk.Button widget is usually displayed as a pushbutton with a
text label. It is generally used to attach a callback function or method
that is called when the button is clicked.
The gtk.Button class has the following constructor −
The following signals are emitted by the Button widget −
The gtk.Button class has the following constructor −
gtk.Button(label = None, stock = None, use_underline = True)Wherein,
- Label − The text to be displayed by the button label
- Stock − The stock id identifying the stock image and text to be used in the button. Default is None.
- Underline − If True, an underscore in the text indicates the next character should be underlined and used for the mnemonic accelerator.
- STOCK_OK
- STOCK_STOP
- STOCK_YES
- STOCK_NO
- STOCK_QUIT
- STOCK_CANCEL
- STOCK_CLOSE
S.NO | Methods and Description |
---|---|
1 | set_label() This sets the text of the button label to label. This string is also used to select the stock item if the "use_stock" property is True. |
2 | get_label() This retrieves the text from the label of the button |
3 | set_focus_on_click() If True, the button grabs focus when clicked with the mouse. |
4 | set_alignment() This is the horizontal and vertical alignment of the child widget. The value ranges from 0.0 to 1.0. |
5 | set_image() This sets the image property to the value of image. The "gtkbutton-images" property should be set to True. |
activate | This is emitted when the gtk.Widget's activate() method is called. For a button it causes the "clicked" signal to be emitted. |
clicked | This is emitted when the mouse button is pressed and released while the pointer is over the button or when the button is triggered with the keyboard. |
No comments:
Post a Comment