tkinter and gtk problem

dieter dieter at handshake.de
Sat Sep 27 09:33:02 CEST 2014


Paula Estrella <pestrella at gmail.com> writes:

> Hello, we are working on ubuntu 12.04 LTS; we use gtk to take screenshots
> and we added a simple interface to select a file using tkFileDialog but it
> doesn't work; is it possible that tkinter and gtk are incompatible? a test
> script to open a file with tkFileDialog works fine but if we import gtk
> even if we don't use it, the dialog box doesn't respond to mouse events
> anymore; if we comment the import gtk it does work ....

UI toolkits (like "tk" and "gtk") usually use a so called event loop
which gets information about user interaction events
(e.g. keyboard/mouse events) and dispatches appropriate application callbacks.

When you use two (or more) such toolkits in the same application,
you need a special event loop which multiplexes the events
to the various toolkits.

The implementation of such a multiplexing event loop might
be difficult (and likely will be dependent on the UI toolkits
to be integrated). Therefore, if possible, try to avoid
combining multiple UI toolkits in the same application.




More information about the Python-list mailing list