Wrapping functions in modules or packages.

A

Antoon Pardon

I'm writing some utilty functions for use with gtk. But
in order to use them correctly I have to know whether
they are called in the gtk-thread or an other.

So my idea was to wrap the gtk.main function so that
it would registrate the thread_id that called it.

So I was thinking about doing something like the
following.


import gtk

import thread

_gtkmain = gtk.main


def main():

global _gtkthread

_gtk_thread = thread.get_ident()
_gtkmain()


gtk.main = main


Is this acceptable? Are there better ways to do things like
this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top