#! /usr/bin/env python

def doSomething():
    return

def doSomethingElse():
    return

def canWeDoSomethingPopup():
    if 'doSomething() exists':
        Add-doSomething-call-to-the-popup()
    if 'doSomethingElse() exists':
        Add-doSomethingElse()-call-to-the-popup()
    return

mainloop()


What's the right way to find out if the function doSomething() is in this program? I want to make up popup context menus (and menubar menus too, I guess) based on what functions are available in a given program. doSomething() may be in one program, but not in another, and I'd like the list of menu items to handle that automatically.

Should I use getargspec() from the inspect module and look for the NameError exception, or just use something like "if doSomething:", or ?

Thanks!

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to