Reputation: 3191
I need to make a gtk.Entry
read-only like without using set_sensitive
, specifically gtk_widget_set_sensitive
will turn off all events, where as I'm only looking to make the entry clearly read-only, but to continue to receive signals.
It also has to be editable under certain circumstances, so gtk.Label
is not an option - whereas gtk.Entry
does not have a selectable
attribute that can be modified.
The only thing I could think of so far is creating a gtk.Entry
, waiting for a user to complete input and then replacing it with a gtk.Label
, this doesn't sound very nice though.
Upvotes: 3
Views: 2470
Reputation: 154886
Set both editable
and can_focus
properties to false.
The former ensures that the entry is read-only (while still receiving events such as selection), and the latter avoids the problem mentioned in the comment where the appearance of the cursor makes the entry appear editable when it's in fact not.
Upvotes: 6