Old 05-17-2018, 02:53 PM   #1
ausbaxter
Human being with feelings
 
Join Date: Apr 2016
Posts: 39
Default Python Persistent Reascript No Defer Implementation?

Greetings, I'm looking to run a deferred python script. When I run the code below I get a traceback error. After looking at reaper_python.py, it looks like RPR_defer, RPR_runloop and RPR_atexit aren't implemented, yet are documented in the [python] API.

I guess you need to run your own event loop when working with persistent python scripts in reaper? I don't need anything rendered, but tkinter would probably be the way to go yes?

And if you're wondering why I'm not using lua or eel, I need to get mousedown events while focused on reaper main window, and unfortunately the gfx window only registers mouse events within the gfx window boundaries. If someone knows how to get general mousedown events through lua (or eel) let me know!

Code:
from reaper_python import *

def main():
	RPR_ShowConsoleMsg("hello?")
	RPR_defer(main)

main()
Running this script will throw the error below when defer is called:

Deferred script execution error

Traceback (most recent call last): File "defer", line 1 <function main at 0x000000000FBA2C80> ^SyntaxError: invalid syntax


Thanks for any help!

Last edited by ausbaxter; 05-17-2018 at 09:35 PM.
ausbaxter is offline   Reply With Quote
Old 05-21-2018, 04:14 AM   #2
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

In case you are still wondering, with Python RPR_defer() takes a string argument for code to be run, so the correct format is...

Code:
RPR_defer("main()")
snooks is offline   Reply With Quote
Old 05-21-2018, 01:57 PM   #3
ausbaxter
Human being with feelings
 
Join Date: Apr 2016
Posts: 39
Default

Yup that was it, derp! Good to know for the future, I ended up finding a solution in lua in the meantime
ausbaxter is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:04 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.