开发者

How do I bring a PyGTK Button to the front?

I have a gtk.Table to which I've attached a number of gtk.Buttons, some of which overlap others. I can't figure out how to bring a specific button to th开发者_StackOverflowe front, however. How do I do it?


I've struggled with an issue similar to this, and came to the conclusion that it wasn't possible in an officially documented manner... gtk.Table doesn't seem to have been designed to deal with the idea that things might overlap. Widgets seemed to be rendered in an order related to (but not exactly) the order they were added into the table.

What I ended up doing was determining which widgets were overlapping, and wrote code to toggle their visibility, depending on which one was appropriate for the current state. That was only possible because of the particular nature of my app, it might not work for you.

One avenue which I didn't research to far, but might be viable: intercepting the expose event on the gtk table, and propagating it to the children in a specific order (this got complicated quickly, but might work). My understanding of the gtk.Widget events is incomplete, there may be other events that need intercepting as well.


You could try to use the Clutter toolkit, I believe this is more suitable for putting widgets on surfaces that you can then animate and move around. It's also built on the same technology as GTK, so it won't be too unfamiliar.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜