Re: Creating a non-focused window



On Fri, May 23, 2008 at 9:52 AM, Brian J. Tarricone <bjt23 cornell edu>
wrote:

Well, it works here, using straight C.  I don't really know Python, so I
can't really say why it wouldn't work there.


Thanks a lot Brian. Could you perchance paste the code you used?  If this is
a bug in PyGTK, it would help to have a reference working implementation.

I'm attaching below my non-working minimal implementation, using
set_focus_on_map(False), just for general information. This creates a small
button on the top-left corner, and (undesirably) gives it the focus.

### BEGIN CODE ###

#!/usr/bin/env python

import gtk
import sys

class Notification(object):
    def __init__(self):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.connect("destroy", self.destroy)
        self.button = gtk.Button('OK')
        self.button.connect_object("clicked", gtk.Widget.destroy,
self.window)

        self.window.set_focus_on_map(False)

        self.window.add(self.button)
        self.button.show()
        self.window.show()

    def destroy(self, widget, data=None):
        gtk.main_quit()

    def main(self):
        gtk.main()

notification = Notification()
notification.main()

### END CODE ###

Tom


       -brian




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]