Pygtk-entry-class

提供:Dev Guides
移動先:案内検索

PyGTK-エントリークラス

入力ウィジェットは、単一行のテキスト入力ウィジェットです。 入力されたテキストがウィジェットの割り当てよりも長い場合、ウィジェットはカーソル位置が見えるようにスクロールします。

入力クラスは、このクラスのset_visibility()メソッドを使用してパスワードモードで変換できます。 入力されたテキストは、invisible_char()メソッドで選択された文字に置き換えられます。デフォルトは「*」です。

エントリクラスには次のコンストラクタがあります-

gtk.Entry(max = 0)

ここで、maxは入力フィールドの最大長を文字で表しています。 パラメータは数値(0〜65536)を取ります。

次の表は、エントリクラスの重要なメソッドを示しています-

S.NO Methods and Description
1

set_visibility(visible)

falseの場合、文字をデフォルトの非表示文字(「*」)に置き換えることにより、内容が隠されます

2

set_invisible_char(char)

入力フィールドのデフォルトの「*」文字はcharに置き換えられます

3

set_max_length(x)

これにより、「max-length」プロパティがxの値に設定されます。 (0-65536)

4

set_text(str)

これにより、「text」プロパティが str の値に設定されます。 str の文字列は、エントリの現在の内容を置き換えます。

5

get_text()

これは、エントリの内容を含む文字列である「text」プロパティの値を返します。

6

set_alignment()

これにより、「xalign」プロパティが xalign の値に設定されます。 set_alignment()は、Entryフィールド内のコンテンツの水平方向の配置を制御します。

次の信号は、エントリウィジェットによって放出されます-

activate This is emitted when the entry is activated either by user action or programmatically with the *gtk.Widget.activate() *method.
backspace This is emitted when the* Backspace* key is entered from the keyboard.
copy-clipboard This is emitted when the selection text in the entry is copied to the clipboard.
cut-clipboard This is emitted when the selection in the entry is cut and placed in the clipboard.
paste-clipboard This is emitted when the contents of the clipboard are pasted into the entry.