catch a function call

This is the place for queries that don't fit in any of the other categories.

catch a function call

Postby 3t3r4n » Mon Aug 12, 2013 5:18 pm

How can i catch a function call?
Code: Select all
class GameWindow():
   def OnKeyUp(self, key):
Code: Select all
import game
   def bypass(self,key):
      do something

When OnKeyUp is called i want to automaticaly call bypass function without modify ... how can i do this? Something like detours in C++
I've donne this last year but i don't know how :( i don't remember ... it was a function to connect this 2 functions
Posts: 1
Joined: Mon Aug 12, 2013 5:07 pm

Re: catch a function call

Postby micseydel » Mon Aug 12, 2013 7:56 pm

I don't think you can do what you're describing, but you could get that behavior by inheriting from GameWindow, overriding the OnKeyUp method to have it call your desired function and then call the superclass' one.
Join the #python-forum IRC channel on for off-topic chat!

Please prefer not to PM members. The point of the forum is so that anyone can benefit. We don't want to help you over PMs/emails/Skype chats that others can't benefit from :)
User avatar
Posts: 2922
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Return to General Coding Help

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests