Pregunta

I am using pygtk for a gui on a touchscreen computer for a machine user-interface. The user can save at any moment the actual configuration of the machine. When he presses on a button "save config", a virtual keyboard, which I implemented, appears on screen to enable him to introduce the configuration name. My problem is that this keyboard doesn't appear directly after pressing on button "save config". One should wait for a next click anywhere on screen to make it appear.

Here is class keyboard:

class keyboard():

def __init__(self):     

    window = gtk.Window(gtk.WINDOW_TOPLEVEL) 
    window.set_position(1)
    window.set_keep_above(True)
    window.connect("destroy", lambda w: window.destroy())
    window.set_transient_for(self.gui.window) #self.gui.window is the main window
    window.set_destroy_with_parent(True)
    window.set_skip_taskbar_hint(True)
    window.set_skip_pager_hint(True)
    window.connect("delete_event",window.hide_on_delete)
    window.deiconify()
    window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_SPLASHSCREEN)
    window.set_size_request(KBD_WIN_WIDTH,KBD_WIN_HEIGHT)
    window.set_resizable(False)

    table = gtk.Table(rows=5, columns=12, homogeneous=True)
    frame = gtk.Frame()
    frame.add(table)
    window.add(frame)
    """
    ... code to fill the table with buttons
    """
    self.window = window

And here is the call back function called after clicking on button 'save config':

def save_cfg_clicked(self,widget):
    keyboard_ = keyboard(self)
    keyboard_.window.set_keep_above(True)
    keyboard_.window.set_modal(True)
    keyboard_.window.show_all()

I've tried several things like calling the function window.show_all with gobject.idle_add, but that didn't help.

Please note that I am using an xfce desktop. This problem doesn't appear when the program runs on Gnome.

¿Fue útil?

Solución

When removing the line :

window.set_transient_for(self.gui.window)

the problem dissapears.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top