PyGTK – Entry Class


PyGTK – Entry Class


”;


Entry widget is a single-line 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_visibility() 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_visibility(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_alignment()

This sets the “xalign” property to the value of xalign. set_alignment() 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-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.

Advertisements

”;

Leave a Reply

Your email address will not be published. Required fields are marked *