Tkinter and window manager
Stephane Conversy
conversy at lri.fr
Thu Sep 2 05:49:22 EDT 1999
there are two things:
First:
I want to be notified when a document window is raised on top of the
windows stack.
Looking the Xlib and tk doc, we can see that a <Configure> event is
triggered when
XRaiseWindow() is called (which I think is called by the window manager
when one
clicks on the bar).
The problem is that when I bind a toplevel to <Configure> I don't receive
any events.
Second:
The palette must stay on top of the other window.
I think I can do that by calling tkraise on the palette window each time a
document window is raised.
So the problem is:
How to catch that a document window has been raised ?
Thinking about it a little bit more, and after I saw that this little
script in tk doesn't work:
toplevel .t
proc toto {} { puts "yep" }
bind .t <Configure> toto
that is, it soesn't write "yep" when the toplevel is raised, I guess it's a
reparent problem,
because it's the window created by the wm that receives <Configure>...
stef
> True, but one a FocusIn event, you could make palette rise above the
> other windows.
> def coconut_dropped(self, event):
> event.widget.tkraise()
>
> But if you are asking "how can I have one window affect the widgets
> in another window?" That's is much more of a design issue. I would
> suggest having an "application" object which abstracts what you need
> done and calling methods on that object from the palette.
>
> class DrawApp:
> def __init__(self, *args):
> self.process_arguments(args)
> self.current_operation = 'pointer'
> def change_to_pen(self):
> self.current_operation = 'drawWithPen'
> def change_to_brush(self):
> self.current_operation = 'drawWithBrush'
> def start_polygon(self):
> self.current_operation = 'drawPolygon'
> self.operation_data = []
> self.op_state = 'waitingForFirstPoint'
> ...
>
> This makes the palette definition seperate from the implimentation of
> the canvas operations.
>
> This approach can also work with multiwindow focus: the palette affects
> the last/current window (different "DrawApp" objects) with the focus.
>
> -Arcege
--
Stéphane Conversy
http://www-ihm.lri.fr/~conversy/
mailto:conversy at lri.fr
More information about the Python-list
mailing list