Hi, I'm working on a Python package for RV, and I used the Simple Package section from the Reference Manual as a template (shown below)
from rv.rvtypes import * from rv.commands import * from rv.extra_commands import * class PyMyStuffMode(MinorMode): def __init__(self): MinorMode.__init__(self) self.init("py-mystuff-mode", [ ("key-down-->", self.faster, "speed up fps"), ("key-down--<", self.slower, "slow down fps") ], None, [ ("MyStuff", [ ("Increase FPS", self.faster, "=", None), ("Decrease FPS", self.slower, "-", None)] )] ) def faster(self, event): setFPS(fps() * 1.5) displayFeedback("%g fps" % fps(), 2.0); def slower(self, event): setFPS(fps() * 1.0/1.5) displayFeedback("%g fps" % fps(), 2.0); def createMode(): return PyMyStuffMode()
In my callback function I'm trying to access the event information, specifically the name of the menu item that triggered the event. So for example if the slower callback function is triggered by the user selecting the Decrease FPS menuItem, I assume that somewhere in the event parameter I would be able to find the string "Decrease FPS".
However, I get errors when I'm trying to find this information. I'm thinking it's maybe event.sender() (I'm not actually even sure, so if I'm totally off here, that would be valuable information too!), but when I try to call this function I get the following error: "ERROR: Bad argument", which doesn't make much sense since it doesn't take an argument (as far as I know), and I'm not even trying to provide one. I get this error with some other event functions, like event.contents(). Some other event functions work though, like event.name(), which returns "menu".
Anyone run into this before? I'm not the most experienced person, so maybe it's something really silly. Any help is appreciated!
Thanks,
Ray