469,358 Members | 1,628 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

how to attach execute commands to button?

Hi,

Sorry if this is an obvious question but I am new to python and can't seem to find an easy example for what I want to to.

I would like to define a button with tinker and then have that execute a scriptable shell binary file with options.

In TCL/TK, this would be a simple example ;

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/wish -f
  2. frame .rc -borderwidth 2
  3. wm title . "Resources"
  4. pack .rc
  5. button .rc.b -text "Press Me to process"  -command {exec shake -x test.sk}
  6. pack .rc.b
  7.  
Where shake is an executable defined in the environment and test.shk is one of its ascii text process input files.

So, I have looked as os.system and subprocess but I can't see an easy method to do this, like the above, simple 'hello world' type thing.

So in summary, if I went to a shell and typed shake -x test.sk, the shake binary would process its input file test.shk with the argument x and everything is ok. Calling {exec shake -x test.sk} from a tcl/tk script would do the same thing. I just can't seem to find a way to rewrite my example above using python.

Thanks for any help.
Nov 19 '08 #1
1 1833
Curtis Rutland
3,256 Expert 2GB
Please enclose your posted code in [CODE] [/CODE] tags (See How to Ask a Question). Code tags preserve indention and uses a monospaced font.

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [CODE] [/CODE] tags in future.

MODERATOR
Nov 21 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Aymer | last post: by
4 posts views Thread by bhatiaajay | last post: by
3 posts views Thread by Lyle Fairfield | last post: by
15 posts views Thread by Madhanmohan S | last post: by
15 posts views Thread by tmp123 | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.