Gtk.PasswordEntry

g GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget Gtk.Editable Gtk.Editable GObject.GInterface->Gtk.Editable GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.PasswordEntry Gtk.PasswordEntry Gtk.Editable->Gtk.PasswordEntry Gtk.Widget->Gtk.PasswordEntry

Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Gtk.Editable (27)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new ()

get_extra_menu ()

get_show_peek_icon ()

set_extra_menu (model)

set_show_peek_icon (show_peek_icon)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9), Gtk.Editable (9)

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1), Gtk.Editable (8)

Name

Type

Flags

Short Description

activates-default

bool

r/w/en

extra-menu

Gio.MenuModel

r/w/en

placeholder-text

str

r/w

show-peek-icon

bool

r/w/en

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1), Gtk.Editable (3)

Name

Short Description

activate

Emitted when the entry is activated.

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1), Gtk.Editable (3)

Class Details

class Gtk.PasswordEntry(**kwargs)
Bases:

Gtk.Widget, Gtk.Editable

Abstract:

No

Structure:

Gtk.PasswordEntryClass

GtkPasswordEntry is an entry that has been tailored for entering secrets.

An example Gtk.PasswordEntry

It does not show its contents in clear text, does not allow to copy it to the clipboard, and it shows a warning when Caps Lock is engaged. If the underlying platform allows it, GtkPasswordEntry will also place the text in a non-pageable memory area, to avoid it being written out to disk by the operating system.

Optionally, it can offer a way to reveal the contents in clear text.

GtkPasswordEntry provides only minimal API and should be used with the [iface`Gtk`.Editable] API.

CSS Nodes

`` entry.password ╰── text

├── image.caps-lock-indicator ┊

``

GtkPasswordEntry has a single CSS node with name entry that carries a .passwordstyle class. The text Css node below it has a child with name image and style class .caps-lock-indicator for the Caps Lock icon, and possibly other children.

Accessibility

GtkPasswordEntry uses the Gtk.AccessibleRole.TEXT_BOX role.

classmethod new()[source]
Returns:

a new GtkPasswordEntry

Return type:

Gtk.Widget

Creates a GtkPasswordEntry.

get_extra_menu()[source]
Returns:

the menu model

Return type:

Gio.MenuModel or None

Gets the menu model set with Gtk.PasswordEntry.set_extra_menu().

get_show_peek_icon()[source]
Returns:

True if an icon is shown

Return type:

bool

Returns whether the entry is showing an icon to reveal the contents.

set_extra_menu(model)[source]
Parameters:

model (Gio.MenuModel or None) – a GMenuModel

Sets a menu model to add when constructing the context menu for self.

set_show_peek_icon(show_peek_icon)[source]
Parameters:

show_peek_icon (bool) – whether to show the peek icon

Sets whether the entry should have a clickable icon to reveal the contents.

Setting this to False also hides the text again.

Signal Details

Gtk.PasswordEntry.signals.activate(password_entry)
Signal Name:

activate

Flags:

RUN_LAST, ACTION

Parameters:

password_entry (Gtk.PasswordEntry) – The object which received the signal

Emitted when the entry is activated.

The keybindings for this signal are all forms of the Enter key.

Property Details

Gtk.PasswordEntry.props.activates_default
Name:

activates-default

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to activate the default widget when Enter is pressed.

Gtk.PasswordEntry.props.extra_menu
Name:

extra-menu

Type:

Gio.MenuModel

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

A menu model whose contents will be appended to the context menu.

Gtk.PasswordEntry.props.placeholder_text
Name:

placeholder-text

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The text that will be displayed in the GtkPasswordEntry when it is empty and unfocused.

Gtk.PasswordEntry.props.show_peek_icon
Name:

show-peek-icon

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to show an icon for revealing the content.