Want a gladevcp button to execute a python script

More
07 Jan 2016 23:38 #68036 by tome
I want a button in my GladeVCP panel directly execute a python script when clicked. I have always had HAL buttons execute MDI commands which can be done by just clicking stuff in the Glade editor. Is there something I am missing in the glade editor in order to have a HAL button (or should I just use a regular button in glade?) point to an executable whose first line is #!/usr/bin/python? Or do I need something else to make this happen?

Tom

Please Log in or Create an account to join the conversation.

More
08 Jan 2016 02:22 #68043 by cmorley
A regular button will do.
You must add a callback function name to a signal of the button widget.
if you click the button then look on the properties window on the right.
Look for signal, look for 'clicked' or 'pressed' and add a function name under handler.
In your python script you must name a function with the same name.

The file name is designated on the line used to load gladevcp
www.linuxcnc.org/docs/2.7/html/gui/glade..._callbacks_in_python
Chris M

Please Log in or Create an account to join the conversation.

More
08 Jan 2016 02:50 #68045 by tome
Thanks Chris, I'll give it a try tomorrow.
Tom

Please Log in or Create an account to join the conversation.

Moderators: HansU
Time to create page: 0.073 seconds
Powered by Kunena Forum