- Posts: 91
- Thank you received: 0
SOLVED....Pathpilot python adding global variables HELP?
2 years 11 months ago #285870
by Dorro1971
Hi folks, I hope someone out there can help me.....
I want to add a variable to tormach_mill_ui.py, I want to initialise it at a value of 100 and i would line to increment of decrement this value under keyboard functions further down the code as suggested in the discussion
forum.linuxcnc.org/pathpilot/48745-gui-m...ode-snippets-toolbox
I would like to use this variable as shown
[/b][/code]
I want to add a variable to tormach_mill_ui.py, I want to initialise it at a value of 100 and i would line to increment of decrement this value under keyboard functions further down the code as suggested in the discussion
forum.linuxcnc.org/pathpilot/48745-gui-m...ode-snippets-toolbox
I would like to use this variable as shown
Code:
#initialise or define somwhere......
new_variable = 100
#under keyboard functions
if kv == gtk.keysyms.a:
[b] new_variable=new_variable + 2
if new_variable > 100 then new_variable = 100
self.sliders['jog_speed'].adjustment.set_value(new_variable)
return True
This way I can use a keystroke to both increment and decrement jog_speed.
I know I can write to jog_speed with a static value but that would require a keystroke for each value!
I also know my syntax is bad for the bold letters but that's where your help also comes in
If i add the following i can send a static value, but that's not what I want..
[code]#under keyboard functions
if kv == gtk.keysyms.a:
new_variable = 100
self.sliders['jog_speed'].adjustment.set_value(new_variable)
return True
Any help would be greatly appreciated.
cheers,
Ian
Please Log in to join the conversation.
2 years 11 months ago #285892
by Dorro1971
Replied by Dorro1971 on topic SOLVED....Pathpilot python adding global variables HELP?
I just needed to add a list and initialise the variables..
see this post
forum.linuxcnc.org/pathpilot/49049-overr...tons?start=10#285891
thanks for looking
see this post
forum.linuxcnc.org/pathpilot/49049-overr...tons?start=10#285891
thanks for looking
Please Log in to join the conversation.
Time to create page: 0.106 seconds
