Login | Register 
FEATURES
APPLICATIONS
DOWNLOADS
EDUCATION
BLOG
WIKI
FORUM
STORE

RMB_Menu triggered by Python

Discuss help and learning documents. Submit your ideas for future tutorials and documents

RMB_Menu triggered by Python

Postby pdubost » Tue Jul 26, 2016 1:18 pm

Is it possible to trigger the RMB Menu options of an OP with Python
http://www.derivative.ca/wiki088/index. ... e=RMB_Menu

I would like to be able to make a Save Component... on a Table DAT so the Windows Directory Menu pops out

(ie. not the op(name).save() method)

If yes it would be super helpful to have this in this wiki page

thanks a lot !
pdubost
 
Posts: 63
Joined: Tue Dec 27, 2011 6:30 pm

Re: RMB_Menu triggered by Python

Postby nettoyeur » Tue Jul 26, 2016 2:08 pm

Well you can only do 'Save component' on components. But on Table DAT you can save the contents.

put these two lines in a script and run it.

Code: Select all
path = ui.chooseFile(load=False,fileTypes=['txt'],title='Save table as:')
op('table1').save(path);


you can read about it in the wiki on the UI class

I've made an example with a "Save As..." button
Attachments
save-as-dialog-example.toe
(4.67 KiB) Downloaded 137 times
Idzard Kwadijk | freelance TouchDesigner consultant | LinkedIn
nettoyeur
 
Posts: 749
Joined: Mon Oct 15, 2012 12:00 pm
Location: Amsterdam, The Netherlands

Re: RMB_Menu triggered by Python

Postby pdubost » Wed Jul 27, 2016 9:05 am

Thanks a lot !
Exactly what I needed :)

this should be added to the wiki page I think
pdubost
 
Posts: 63
Joined: Tue Dec 27, 2011 6:30 pm

Re: RMB_Menu triggered by Python

Postby rob » Thu Jul 28, 2016 10:07 am

Thanks for the example.
We've added it to the wiki examples.
User avatar
rob
Staff
 
Posts: 1386
Joined: Tue Nov 13, 2007 1:14 am


Return to TouchDesigner Documentation

Who is online

Users browsing this forum: No registered users and 1 guest