python - focus-in-event fires even when entry is not focused -
I am creating a gtk.Entry, and want to hook into its "focus in" event, so I use virtual keyboard:
Class LabelEntry (gtk.HBox): # ... initialization ... self.keyboard = virtual keyboard. Virtual key board () self.entry = gtk.Entry () self.entry .connect ('focus-in-event', auto keyboard.focus_handler) # ... gtk.Entry attached for this gtk.HBox and more Do ... This opens the Focus_Handler callback that is contained within the Virtual Keyboard class, and a new window is a current one Is displayed above. Once the virtual keyboard window is dismissed, I see the original window with the update value for that self.entry . However, if I tap anywhere on the original window (not even on gtk.Entry, the same callback has been removed and the virtual keyboard is displayed again. What will happen to Gtk.Entry to register as a "Focus in" event anywhere on the original window? Do I need to blur the focus when I open a new window, or create a flag Indicates that I already lost the window And it should not be opened again?
EDIT
This comes from a guiutil.py file, Plus A new virtual keyboard (,) When an entry is selected, it should be opened. Am I trying to avoid a difficult "click" before it? Did you lose focus? Have you just focused, but you were clicked first and ignore this focus event? "Logic Puzzle.
:: The Focus-in-Event signal will be emitted when Keyboard Focus will enter the widget window . To get this indication, GdkWindow attached to the widget needs to enable the GDK_FOCUS_CHANGE_MASK mask.
So this is the desired behavior.
To get whatever you want, you can simply check if the desired widget is actually taken into account through gtk_widget_is_focus (...) (this Gtk_widget_has_focus (...) - RTM for details).
Comments
Post a Comment