gtkentry

How to remove highlight from entry in pygtk?

心不动则不痛 提交于 2019-12-24 13:42:36
问题 i have a small GUI that i created, and when it fires up, the 'first' gtk.Entry that i have created is always highlighted (in a series of entries). essentially, here is how i create it: my_entry = gtk.Entry(1) my_entry.set_width_chars(1) my_entry.set_alignment(0.5) my_entry.set_text('1') i then go on to create several more entries. i then call 'show' on them all at the same time, and then use 'pack_start' to put them into a vbox. whenever i start the GUI, the '1' is highlighted. how can i

find out which gtk widget has the current selection

会有一股神秘感。 提交于 2019-12-12 11:16:22
问题 I have a collection of GtkEntry widgets, some of which are editable and focusable, and some of which are not. I would like to find out which, if any, of them currently has text selected, in order to implement an Edit->Copy menu item. Is there any way to do this other than iterating over all the widgets until gtk_editable_get_selection_bounds returns true? I am currently sidestepping the issue by calling gtk_clipboard_get(GDK_SELECTION_PRIMARY) but from what the docs say, that's not portable

GtkWindow can only contain one widget at a time

梦想的初衷 提交于 2019-12-10 11:27:55
问题 I am using this code to retrieve and display an image from the web: class Display(object): def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect('destroy', self.destroy) self.window.set_border_width(10) self.image = gtk.Image() response = urllib2.urlopen('http://image.url/image.jpg').read() pbuf = gtk.gdk.PixbufLoader() pbuf.write(response) pbuf.close() self.image.set_from_pixbuf(pbuf.get_pixbuf()) self.window.add(self.image) self.image.show() self.window.show(

GTK+ (2.0) - signal “clicked” on GtkEntry?

安稳与你 提交于 2019-12-07 11:30:10
问题 I'm testing some signals with GTK+ 2.0. I'm looking for a way to get a signal emitted when I click on a GtkEntry. if (widgets_info[i].action & IG_INPUT) { widget->frame[i] = gtk_entry_new_with_max_length(MAX_INPUT_LENGTH); gtk_entry_set_text(widget->frame[i], widgets_info[i].text); catch_signal(widget->frame[i], MY_SIGNAL, &change_entry, widget); } I have a pre-selected text in my entry ( widgets_info[i].text ) and i want this text to disappear if the user click on my GtkEntry. Does someone

GtkWindow can only contain one widget at a time

▼魔方 西西 提交于 2019-12-06 06:00:06
I am using this code to retrieve and display an image from the web: class Display(object): def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect('destroy', self.destroy) self.window.set_border_width(10) self.image = gtk.Image() response = urllib2.urlopen('http://image.url/image.jpg').read() pbuf = gtk.gdk.PixbufLoader() pbuf.write(response) pbuf.close() self.image.set_from_pixbuf(pbuf.get_pixbuf()) self.window.add(self.image) self.image.show() self.window.show() def main(self): gtk.main() def destroy(self, widget, data=None): gtk.main_quit() It works, however I

Python Gtk.Entry placeholder text

a 夏天 提交于 2019-12-05 23:39:39
问题 i have a login-window with two gtk.Entry objects, one for username, one for password. How can i add some Ghosttext to the Entry, so there is written "Username" in the Entry but if you click inside the text dissapears. 回答1: Starting with Gtk+ 3.2 it's possible to set placeholder text. entry = Gtk.Entry() entry.set_placeholder_text("I am a placeholder") 回答2: I've found an example where .set_text() and .select_region() are used to preselect the text, so it is deleted when the user starts to type

GTK+ (2.0) - signal “clicked” on GtkEntry?

坚强是说给别人听的谎言 提交于 2019-12-05 16:58:04
I'm testing some signals with GTK+ 2.0. I'm looking for a way to get a signal emitted when I click on a GtkEntry. if (widgets_info[i].action & IG_INPUT) { widget->frame[i] = gtk_entry_new_with_max_length(MAX_INPUT_LENGTH); gtk_entry_set_text(widget->frame[i], widgets_info[i].text); catch_signal(widget->frame[i], MY_SIGNAL, &change_entry, widget); } I have a pre-selected text in my entry ( widgets_info[i].text ) and i want this text to disappear if the user click on my GtkEntry. Does someone know what is this signal? (Sorry for my English) Try focus-in-event , note that you must enable focus