Gtk2::Entry(3)
π Gtk2::Entry β the manual page, bestie edition π
okay so. Gtk2::Entry(3) β that's the page we're on, from the User Contributed Perl Documentation corner of the world. It's a wrapper for GtkEntry. That's it. That's the vibe. One line of text box energy and honestly? iconic.
β¨ HIERARCHY β¨
the family tree, no cap. this is where Entry sits in the whole ancestry situation:
Glib::Object
+----Glib::InitiallyUnowned
+----Gtk2::Object
+----Gtk2::Widget
+----Gtk2::Entry
it's giving "descended from greatness" fr fr π
π¦ INTERFACES π¦
these are the interfaces it implements β the little personality traits it picked up along the way:
Glib::Object::_Unregistered::AtkImplementorIfaceGtk2::BuildableGtk2::EditableGtk2::CellEditable
so it can be built, it can be edited, it can be edited in a cell. versatile queen π
πΈ METHODS πΈ
this is the big one. buckle up, there's a LOT. take it slow, hydrate, we got this.
widget = Gtk2::Entry->new
make a fresh lil Entry. blank slate. main character debut β¨
widget = Gtk2::Entry->new_with_buffer ($buffer)
$buffer(Gtk2::EntryBuffer)
Since: gtk+ 2.18
same but you hand it a buffer to live in.
widget = Gtk2::Entry->new_with_max_length ($max)
$max(integer)
new entry, but it comes with a character limit already installed. built different.
boolean = $entry->get_activates_default / $entry->set_activates_default ($setting)
$setting(boolean)
get/set whether hitting enter in here triggers the default widget. the "just press go" setting π
double = $entry->get_alignment
Since: gtk+ 2.4
$entry->set_alignment ($xalign)
$xalign(double)
Since: gtk+ 2.4
how far left/right the text sits in the box. alignment check, but make it literal β¨
$entry->append_text ($text)
$text(string)
stick text on the end. the "and also" of text entry.
entrybuffer = $entry->get_buffer
Since: gtk+ 2.18
$entry->set_buffer ($buffer)
$buffer(Gtk2::EntryBuffer)
Since: gtk+ 2.18
the buffer is where the actual text lives. you can grab it or swap it out.
entrycompletion or undef = $entry->get_completion
Since: gtk+ 2.4
$entry->set_completion ($completion)
$completion(Gtk2::EntryCompletionor undef)
Since: gtk+ 2.4
autocomplete bestie! may be undef, so check before you use it, fr.
integer = $entry->get_current_icon_drag_source
Since: gtk+ 2.16
which icon is currently being dragged from. a whole integer for that. sure.
adjustment or undef = $entry->get_cursor_hadjustment
Since: gtk+ 2.12
$entry->set_cursor_hadjustment ($adjustment)
$adjustment(Gtk2::Adjustmentor undef)
Since: gtk+ 2.12
horizontal scrolling behavior for the cursor. can be undef, no biggie.
$entry->set_editable ($editable)
$editable(boolean)
can the user actually type in it or is it just for show. read-only mode is valid too π
boolean = $entry->get_has_frame / $entry->set_has_frame ($setting)
$setting(boolean)
does it have the cute little border frame around it. aesthetic choice, honestly.
boolean = $entry->get_icon_activatable ($icon_pos)
$icon_pos(Gtk2::EntryIconPosition)
Since: gtk+ 2.16
$entry->set_icon_activatable ($icon_pos, $activatable)
$icon_pos(Gtk2::EntryIconPosition)$activatable(boolean)
Since: gtk+ 2.16
can you click the icon. yes/no. $icon_pos tells it which icon you mean.
integer = $entry->get_icon_at_pos ($x, $y)
$x(integer)$y(integer)
Since: gtk+ 2.16
give it coordinates, it tells you which icon is sitting there. coordinate girlie π₯
$entry->set_icon_drag_source ($icon_pos, $target_list, $actions)
$icon_pos(Gtk2::EntryIconPosition)$target_list(Gtk2::TargetList)$actions(Gtk2::Gdk::DragAction)
Since: gtk+ 2.16
make an icon draggable. drag source era.
$entry->set_icon_from_icon_name ($icon_pos, $icon_name)
$icon_pos(Gtk2::EntryIconPosition)$icon_name(string or undef)
Since: gtk+ 2.16
set the icon by name. undef is allowed, so you can clear it too.
$entry->set_icon_from_pixbuf ($icon_pos, $pixbuf)
$icon_pos(Gtk2::EntryIconPosition)$pixbuf(Gtk2::Gdk::Pixbufor undef)
Since: gtk+ 2.16
set the icon from a pixbuf. also accepts undef. flexible π
$entry->set_icon_from_stock ($icon_pos, $stock_id)
$icon_pos(Gtk2::EntryIconPosition)$stock_id(string or undef)
Since: gtk+ 2.16
stock icon by id. undef clears it, as usual.
string or undef = $entry->get_icon_name ($icon_pos)
$icon_pos(Gtk2::EntryIconPosition)
Since: gtk+ 2.16
grab the icon name. might be undef! check it, bestie.
pixbuf or undef = $entry->get_icon_pixbuf ($icon_pos)
$icon_pos(Gtk2::EntryIconPosition)
Since: gtk+ 2.16
grab the pixbuf. also possibly undef.
boolean = $entry->get_icon_sensitive ($icon_pos)
$icon_pos(Gtk2::EntryIconPosition)
Since: gtk+ 2.16
$entry->set_icon_sensitive ($icon_pos, $sensitive)
$icon_pos(Gtk2::EntryIconPosition)$sensitive(boolean)
Since: gtk+ 2.16
is the icon "sensitive" (i.e. reacting to input). set it, get it, slay.
string or undef = $entry->get_icon_stock ($icon_pos)
$icon_pos(Gtk2::EntryIconPosition)
Since: gtk+ 2.16
the stock id of that icon. undef possible, obviously.
imagetype = $entry->get_icon_storage_type ($icon_pos)
$icon_pos(Gtk2::EntryIconPosition)
Since: gtk+ 2.16
what kind of image storage this icon uses. the lore β¨
string or undef = $entry->get_icon_tooltip_markup ($icon_pos)
$icon_pos(Gtk2::EntryIconPosition)
Since: gtk+ 2.16
$entry->set_icon_tooltip_markup ($icon_pos, $tooltip)
$icon_pos(Gtk2::EntryIconPosition)$tooltip(string or undef)
Since: gtk+ 2.16
tooltip, but with markup. undef is fine, it's fine, everything's fine.
string or undef = $entry->get_icon_tooltip_text ($icon_pos)
$icon_pos(Gtk2::EntryIconPosition)
Since: gtk+ 2.16
$entry->set_icon_tooltip_text ($icon_pos, $tooltip)
$icon_pos(Gtk2::EntryIconPosition)$tooltip(string or undef)
Since: gtk+ 2.16
plain text tooltip version. the markup one and this one are siblings, don't mix them up.
window = $entry->get_icon_window ($icon_pos)
$icon_pos(Gtk2::EntryIconPosition)
Since: gtk+ 2.20
the actual window for that icon. window era π
boolean = $entry->im_context_filter_keypress ($event)
$event(Gtk2::Gdk::Event)
Since: gtk+ 2.22
filter a keypress through the input method context. returns a boolean. iykyk.
border or undef = $entry->get_inner_border
Since: gtk+ 2.10
$entry->set_inner_border ($border)
$border(Gtk2::Borderor undef)
Since: gtk+ 2.10
the inner border. can be undef. get it, set it, move on.
character = $entry->get_invisible_char / $entry->set_invisible_char ($ch)
$ch(character)
which character shows up when the text is invisible (password mode, we see you π).
layout = $entry->get_layout
grab the Pango layout the entry is using.
integer = $entry->layout_index_to_text_index ($layout_index)
$layout_index(integer)
Since: gtk+ 2.6
translate a layout index into a text index. two different numbering systems, one little converter. obsessed.
(x, y) = $entry->get_layout_offsets
returns both offsets at once. list context girlie π
integer = $entry->get_max_length / $entry->set_max_length ($max)
$max(integer)
get or set the max number of characters. the limit does exist.
boolean = $entry->get_overwrite_mode
Since: gtk+ 2.14
$entry->set_overwrite_mode ($overwrite)
$overwrite(boolean)
Since: gtk+ 2.14
overwrite mode instead of insert mode. retro typing vibe fr.
$entry->set_position ($position)
$position(integer)
put the cursor at a position. simple. clean. iconic.
$entry->prepend_text ($text)
$text(string)
text at the FRONT. the opposite of append_text. balance β¨
double = $entry->get_progress_fraction
Since: gtk+ 2.16
$entry->set_progress_fraction ($fraction)
$fraction(double)
Since: gtk+ 2.16
progress bar inside your text entry. how much is done. a double. go off.
$entry->progress_pulse
Since: gtk+ 2.16
pulse the progress bar forward. the lil "still working on it" wiggle.
double = $entry->get_progress_pulse_step
Since: gtk+ 2.16
$entry->set_progress_pulse_step ($fraction)
$fraction(double)
Since: gtk+ 2.16
how big each pulse step is. tune it to taste.
$entry->reset_im_context
Since: gtk+ 2.22
reset the input method context. clean slate for the IM.
$entry->select_region ($start, $end)
$start(integer)$end(integer)
select a range of text programmatically. highlight it, bestie π
string = $entry->get_text
get the text. the whole point, honestly.
integer = $entry->text_index_to_layout_index ($text_index)
$text_index(integer)
Since: gtk+ 2.6
the reverse converter of layout_index_to_text_index. they're a matching set π«Ά
unsigned = $entry->get_text_length
Since: gtk+ 2.14
how long the text is. unsigned. count it.
$entry->set_text ($text)
$text(string)
set the text. the other whole point.
window = $entry->get_text_window
Since: gtk+ 2.20
the window for the text area itself. yes, separately. two windows, because why not.
$entry->unset_invisible_char
Since: gtk+ 2.16
undo the invisible char. back to default behavior, periodt.
boolean = $entry->get_visibility / $entry->set_visibility ($visible)
$visible(boolean)
is the text visible or hidden. the password-mode toggle, lowkey.
integer = $entry->get_width_chars / $entry->set_width_chars ($n_chars)
$n_chars(integer)
how wide the entry is, measured in characters. $n_chars of them, exactly.
okay bestie that's part 1 and there is more coming so don't go anywhere π
π PROPERTIES π
okay bestie, this is the full property menu. every bullet is name β type : default value : flags β then the vibe. no skips, no cap. π
'activates-default'βboolean : default false : readable / writable / private / static-nick / static-blurbβ Whether to activate the default widget (like the default button in a dialog) when Enter is pressed. β¨'buffer'βGtk2::EntryBuffer : default undef : readable / writable / construct / private / static-nick / static-blurbβ Text buffer object which actually stores entry text. the storage bestie. π'caps-lock-warning'βboolean : default true : readable / writable / private / static-nick / static-blurbβ Whether password entries will show a warning when Caps Lock is on. iconic. π₯'cursor-position'βinteger : default 0 : readable / private / static-nick / static-blurbβ The current position of the insertion cursor in chars. read-only vibes. π'editable'βboolean : default true : readable / writable / private / static-nick / static-blurbβ Whether the entry contents can be edited. that's the whole question. π'has-frame'βboolean : default true : readable / writable / private / static-nick / static-blurbβFALSEremoves outside bevel from entry. no frame, no problem. β¨'im-module'βstring : default undef : readable / writable / private / static-nick / static-blurbβ Which IM module should be used. that's it, that's the tweet. π¦'inner-border'βGtk2::Border : default undef : readable / writable / private / static-nick / static-blurbβ Border between text and frame. Overrides theinner-borderstyle property. boss move. π'invisible-char'βGlib::UInt : default 42 "*" : readable / writable / private / static-nick / static-blurbβ The character to use when masking entry contents (in "password mode"). default is42 "*", yes really. π'invisible-char-set'βboolean : default false : readable / writable / private / static-nick / static-blurbβ Whether the invisible char has been set. yes or no bestie. πΈ'max-length'βinteger : default 0 : readable / writable / private / static-nick / static-blurbβ Maximum number of characters for this entry. Zero if no maximum.0means no maximum. periodt. π'overwrite-mode'βboolean : default false : readable / writable / private / static-nick / static-blurbβ Whether new text overwrites existing text. type-over mode energy. β¨'primary-icon-activatable'βboolean : default false : readable / writable / private / static-nick / static-blurbβ Whether the primary icon is activatable. yes/no. π'primary-icon-gicon'βGlib::Object::_Unregistered::GIcon : default undef : readable / writable / private / static-nick / static-blurbβGIconfor primary icon. exactly that. π'primary-icon-name'βstring : default undef : readable / writable / private / static-nick / static-blurbβ Icon name for primary icon. name drop. π'primary-icon-pixbuf'βGtk2::Gdk::Pixbuf : default undef : readable / writable / private / static-nick / static-blurbβ Primary pixbuf for the entry. pixels, but make it primary. β¨'primary-icon-sensitive'βboolean : default true : readable / writable / private / static-nick / static-blurbβ Whether the primary icon is sensitive. default says yes. π₯Ί'primary-icon-stock'βstring : default undef : readable / writable / private / static-nick / static-blurbβ Stock ID for primary icon. old-school but valid. π'primary-icon-storage-type'βGtk2::ImageType : default "empty" : readable / private / static-nick / static-blurbβ The representation being used for primary icon. read-only, default"empty". π«Ά'primary-icon-tooltip-markup'βstring : default undef : readable / writable / private / static-nick / static-blurbβ The contents of the tooltip on the primary icon. markup edition. π'primary-icon-tooltip-text'βstring : default undef : readable / writable / private / static-nick / static-blurbβ The contents of the tooltip on the primary icon. same tooltip energy, text edition. β¨'progress-fraction'βdouble : default 0 : readable / writable / private / static-nick / static-blurbβ The current fraction of the task that's been completed. progress bar moment. π₯'progress-pulse-step'βdouble : default 0.1 : readable / writable / private / static-nick / static-blurbβ The fraction of total entry width to move the progress bouncing block for each call togtk_entry_progress_pulse(). bouncing block supremacy. π'scroll-offset'βinteger : default 0 : readable / private / static-nick / static-blurbβ Number of pixels of the entry scrolled off the screen to the left. read-only. π'secondary-icon-activatable'βboolean : default false : readable / writable / private / static-nick / static-blurbβ Whether the secondary icon is activatable. the sequel. π'secondary-icon-gicon'βGlib::Object::_Unregistered::GIcon : default undef : readable / writable / private / static-nick / static-blurbβGIconfor secondary icon. matching set. β¨'secondary-icon-name'βstring : default undef : readable / writable / private / static-nick / static-blurbβ Icon name for secondary icon. π'secondary-icon-pixbuf'βGtk2::Gdk::Pixbuf : default undef : readable / writable / private / static-nick / static-blurbβ Secondary pixbuf for the entry. the other pixbuf. π'secondary-icon-sensitive'βboolean : default true : readable / writable / private / static-nick / static-blurbβ Whether the secondary icon is sensitive. default yes, be gentle. π₯Ί'secondary-icon-stock'βstring : default undef : readable / writable / private / static-nick / static-blurbβ Stock ID for secondary icon. vintage. π'secondary-icon-storage-type'βGtk2::ImageType : default "empty" : readable / private / static-nick / static-blurbβ The representation being used for secondary icon. read-only, default"empty". π«Ά'secondary-icon-tooltip-markup'βstring : default undef : readable / writable / private / static-nick / static-blurbβ The contents of the tooltip on the secondary icon. markup flavor. π'secondary-icon-tooltip-text'βstring : default undef : readable / writable / private / static-nick / static-blurbβ The contents of the tooltip on the secondary icon. same but text flavor. β¨'selection-bound'βinteger : default 0 : readable / private / static-nick / static-blurbβ The position of the opposite end of the selection from the cursor in chars. read-only. π'shadow-type'βGtk2::ShadowType : default "in" : readable / writable / private / static-nick / static-blurbβ Which kind of shadow to draw around the entry whenhas-frameis set. default"in". π'text'βstring : default "" : readable / writable / private / static-nick / static-blurbβ The contents of the entry. main character. π'text-length'βGlib::UInt : default 0 : readable / private / static-nick / static-blurbβ Length of the text currently in the entry. read-only. β¨'truncate-multiline'βboolean : default false : readable / writable / private / static-nick / static-blurbβ Whether to truncate multiline pastes to one line. yes/no. π'visibility'βboolean : default true : readable / writable / private / static-nick / static-blurbβFALSEdisplays the "invisible char" instead of the actual text (password mode). password mode, bestie. π'width-chars'βinteger : default -1 : readable / writable / private / static-nick / static-blurbβ Number of characters to leave space for in the entry. default-1. π'xalign'βfloat : default 0 : readable / writable / private / static-nick / static-blurbβ The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts. β¨
πΈ STYLE PROPERTIES πΈ
these are the style-property girlies. same deal: name, type/default/flags, then the vibe. π
'icon-prelight'βboolean : default true : readable / private / static-nick / static-blurbβ Whether activatable icons should prelight when hovered. default true. β¨'inner-border'βGtk2::Border : default undef : readable / private / static-nick / static-blurbβ Border between text and frame. simple. π'invisible-char'βGlib::UInt : default 0 "\0" : readable / private / static-nick / static-blurbβ The character to use when masking entry contents (in "password mode"). default0 "\0"β yes, the null char is here. π'progress-border'βGtk2::Border : default undef : readable / private / static-nick / static-blurbβ Border around the progress bar. cute. π'state-hint'βboolean : default false : readable / private / static-nick / static-blurbβ Whether to pass a proper state when drawing shadow or background. default false. π
π₯ SIGNALS π₯
here's the signal lineup, with exact signatures. no invented lore, just the facts. π
activate (Gtk2::Entry)backspace (Gtk2::Entry)copy-clipboard (Gtk2::Entry)cut-clipboard (Gtk2::Entry)delete-from-cursor (Gtk2::Entry, Gtk2::DeleteType, integer)icon-press (Gtk2::Entry, Gtk2::EntryIconPosition, Gtk2::Gdk::Event)icon-release (Gtk2::Entry, Gtk2::EntryIconPosition, Gtk2::Gdk::Event)insert-at-cursor (Gtk2::Entry, string)move-cursor (Gtk2::Entry, Gtk2::MovementStep, integer, boolean)paste-clipboard (Gtk2::Entry)populate-popup (Gtk2::Entry, Gtk2::Menu)preedit-changed (Gtk2::Entry, string)toggle-overwrite (Gtk2::Entry)
π ENUMS AND FLAGS π
π enum Gtk2::DeleteType
'chars'/'GTK_DELETE_CHARS''word-ends'/'GTK_DELETE_WORD_ENDS''words'/'GTK_DELETE_WORDS''display-lines'/'GTK_DELETE_DISPLAY_LINES''display-line-ends'/'GTK_DELETE_DISPLAY_LINE_ENDS''paragraph-ends'/'GTK_DELETE_PARAGRAPH_ENDS''paragraphs'/'GTK_DELETE_PARAGRAPHS''whitespace'/'GTK_DELETE_WHITESPACE'
π enum Gtk2::EntryIconPosition
'primary'/'GTK_ENTRY_ICON_PRIMARY''secondary'/'GTK_ENTRY_ICON_SECONDARY'
β¨ flags Gtk2::Gdk::DragAction
'default'/'GDK_ACTION_DEFAULT''copy'/'GDK_ACTION_COPY''move'/'GDK_ACTION_MOVE''link'/'GDK_ACTION_LINK''private'/'GDK_ACTION_PRIVATE''ask'/'GDK_ACTION_ASK'
πΈ enum Gtk2::ImageType
'empty'/'GTK_IMAGE_EMPTY''pixmap'/'GTK_IMAGE_PIXMAP''image'/'GTK_IMAGE_IMAGE''pixbuf'/'GTK_IMAGE_PIXBUF''stock'/'GTK_IMAGE_STOCK''icon-set'/'GTK_IMAGE_ICON_SET''animation'/'GTK_IMAGE_ANIMATION''icon-name'/'GTK_IMAGE_ICON_NAME''gicon'/'GTK_IMAGE_GICON'
π
enum Gtk2::MovementStep
'logical-positions'/'GTK_MOVEMENT_LOGICAL_POSITIONS''visual-positions'/'GTK_MOVEMENT_VISUAL_POSITIONS''words'/'GTK_MOVEMENT_WORDS''display-lines'/'GTK_MOVEMENT_DISPLAY_LINES''display-line-ends'/'GTK_MOVEMENT_DISPLAY_LINE_ENDS''paragraphs'/'GTK_MOVEMENT_PARAGRAPHS''paragraph-ends'/'GTK_MOVEMENT_PARAGRAPH_ENDS''pages'/'GTK_MOVEMENT_PAGES''buffer-ends'/'GTK_MOVEMENT_BUFFER_ENDS''horizontal-pages'/'GTK_MOVEMENT_HORIZONTAL_PAGES'
π enum Gtk2::ShadowType
'none'/'GTK_SHADOW_NONE''in'/'GTK_SHADOW_IN''out'/'GTK_SHADOW_OUT''etched-in'/'GTK_SHADOW_ETCHED_IN''etched-out'/'GTK_SHADOW_ETCHED_OUT'
π«Ά SEE ALSO π«Ά
Gtk2Glib::ObjectGlib::InitiallyUnownedGtk2::ObjectGtk2::Widget
π COPYRIGHT π
Copyright (C) 2003-2011 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
this page is perl v5.42.0, dated 2025-07-25, and it's Gtk2::Entry(3) β bye bestie, hydrate and read your docs πβ¨
π¦ where this page comes from
- fedora 43: perl-Gtk2 1.24993-23.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms