The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Python script: choose Worksheet+Column by clicking
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

beathovn

Germany
Posts

Posted - 04/15/2016 :  10:45:39 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): Origin 2015 (64bit) SR2
Operating System: Windows 10 Pro

I have written a small Python script, that does some maths with two columns from two different worksheets. Currently, the worksheet and column names are input using a small pop-up TkInter window and Entry objects, i.e. by typing their full name in the form "[LongBookName]LongColumnName!" into a pop-up window. As this is rather cumbersome, I wonder, whether it is possible to let the user choose the column by clicking and read out (via Python or some other programmatic way) which Book and column was chosen?
In principle, this would be the same functionality as is used directly in Origin, e.g. when using "Analysis - Mathematics - Simple Column Math..." or some other functions around there.

Thank you very much for your help!

Best regards,
Jan

jasonzhao

China
262 Posts

Posted - 04/19/2016 :  04:55:33 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

You can try to implement this feature by using
GetSelectedColumns and ActiveLayer function:

Please refer to these pages for function usage:
http://www.originlab.com/doc/python/PyOrigin/Classes/Worksheet-GetSelectedColumns
http://www.originlab.com/doc/python/PyOrigin/Global-Functions/ActiveLayer

Best regards!
Jason
OriginLab Technical Service
Go to Top of Page

beathovn

Germany
Posts

Posted - 05/13/2016 :  03:39:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Very nice - thanks a lot!

For reference, this is now the code that I use:


MyLayer=PyOrigin.ActiveLayer()
MyLayerName=MyLayer.GetName()
MyLayerPage=MyLayer.GetPage()
MyPageName=MyLayerPage.GetName()
MyFullName="["+MyPageName+"]"+MyLayerName+"!"
MyColumn=MyLayer.GetSelectedColumns()[0]


Thanks again and best regards,
Jan
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000