English 中文(简体)
PyGTK - Entry Class
  • 时间:2024-12-22

PyGTK - Entry Class


Previous Page Next Page  

Entry widget is a single-pne text entry widget. If the entered text is longer than the allocation of the widget, the widget will scroll so that the cursor position is visible.

Entry field can be converted in password mode using set_visibipty() method of this class. Entered text is substituted by character chosen by invisible_char() method, default being * .

The Entry class has the following constructor −

gtk.Entry(max = 0)

Here, max stands for maximum length of entry field in characters. The parameter takes a numeric value (0-65536).

The following table shows the important methods of an Entry class −

S.NO Methods and Description
1

set_visibipty(visible)

If false, the contents are obscured by replacing the characters with the default invisible character — *

2

set_invisible_char(char)

The default * characters in the entry field are replaced by char

3

set_max_length(x)

This sets the "max-length" property to the value of x. (0-65536)

4

set_text(str)

This sets the "text" property to the value of str. The string in str replaces the current contents of the entry.

5

get_text()

This returns the value of the "text" property which is a string containing the contents of the entry.

6

set_apgnment()

This sets the "xapgn" property to the value of xapgn. set_apgnment() controls the horizontal positioning of the contents in the Entry field.

The following signals are emitted by entry widget −

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-cppboard This is emitted when the selection text in the entry is copied to the cppboard.
cut-cppboard This is emitted when the selection in the entry is cut and placed in the cppboard.
paste-cppboard This is emitted when the contents of the cppboard are pasted into the entry.
Advertisements