简体   繁体   中英

Finding what calls a def from a Python GUI app

I'm trying to understand a Python app developed by a peer who left the company. There is a def in a class of a module that I am trying to find what within the GUI would invoke it. I am using Visual Studio and have Python Tools installed.

I know about shift-F12 but it doesn't seem to do the same as Java and Eclipse, which I am more versed in. So I'm getting frustrated.

Module: LoadSet.py

...other classes in this file...
class LoadSet_Base(object):
   ...other def in this Class...
    def copy_from(self, that):
       I have a break in this section but I never can get into this section

There are over 200 Classes in the project so it is not a small project. I've taken a number of Python training modules at SkillPort and all have been basic teachings of the language, and seem way more straightforward than my ex-peer's code. Perhaps my ex-peer's code is not pythonic!

So how can I find what widget, click, action etc... within a GUI (wxPython) app would invoke this method?

I usually use the IDE to find all usages of a particular function if I don't know how it is used. PyCharm and Wingware both have this built in. I would be greatly surprised if Visual Studio didn't have some kind of right-click support for this too.

If all else fails, grep for that function name in the entirety of the source.

It is possible that you have found an instance of dead code too. Perhaps the code was refactored and that function / method is no longer called.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM