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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Python script: choose Worksheet+Column by clicking

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
beathovn Posted - 04/15/2016 : 10:45:39 AM
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
2   L A T E S T    R E P L I E S    (Newest First)
beathovn Posted - 05/13/2016 : 03:39:48 AM
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
jasonzhao Posted - 04/19/2016 : 04:55:33 AM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000