📜  PyGTK-标签类

📅  最后修改于: 2020-11-08 07:46:42             🧑  作者: Mango


标签窗口小部件可用于显示不可编辑的文本。标签在内部被许多其他小部件使用。例如,Button有一个标签可以在脸上显示文本。同样,MenuItem对象也具有标签。标签是无窗口对象,因此它不能直接接收事件。

Label类具有一个简单的构造函数-

gtk.Label(str = None)

以下有用的方法可以与Label对象一起使用-

S.NO Methods and Description
1

set_text()

This sets new text as label

2

get_text()

This returns text from label

3

set_use_underline()

If true, an underscore in the text indicates the next character should be used for the mnemonic accelerator key.

4

set_justify

This sets the alignment of the lines in the text of the label relative to each other.

Possible values are – gtk.JUSTIFY_LEFT, gtk.JUSTIFY_RIGHT, gtk.JUSTIFY_CENTER, and gtk.JUSTIFY_FILL.

5

Set_line_wrap()

If true, the line will be wrapped

6

set_selectable()

If true, the text in the label can be selected for copy-paste

7

set_width_chars()

This sets the width of a label

标签小部件发出以下信号-

activate-current-link This gets emitted when the user activates a link in the label.
activate-link This gets emitted to activate a URI.
copy-clipboard This gets emitted when text is copied from the label to the clipboard.