<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># ~ W = root_window.tk.call


##########################################################################################
##########     MODIFYING AXIS KEYBINDING MADE EASY BUT NOT TOO EASY   ##########
##########################################################################################


###   this file goes into the same folder as your config
###     add this line to your ini file, under the display section (without the #)
###     USER_COMMAND_FILE = usercommand_keybind.py

###   unbind a key first (if needed), then rebind  to your new thing, for example
###         the down key is unbound
#######    root_window.unbind('&lt;Down&gt;')
#          then rebind it to your new command
#          root_window.bind('&lt;Down&gt;', select_next)

####   this is for binding axis jog keys , the number at the end is the joint
#   bind right and left keys to joint 0, usually x
#   bind_axis("Right", "Left", 0)
#   bind down and up keys to joint 1, usually y
#   bind_axis("Down", "Up", 1)


#####   example for a user on the forum doing jog things


root_window.unbind("Prior")
root_window.unbind("Next")
root_window.unbind("Home")
root_window.unbind("End")
root_window.unbind("KP_Left")
root_window.unbind("KP_Right")
root_window.unbind("KP_Down")
root_window.unbind("KP_Up")
root_window.unbind("KP_Next")
root_window.unbind("KP_Prior")
root_window.unbind("KP_Home")
root_window.unbind("KP_End")
root_window.unbind("KP_7")
root_window.unbind("KP_1")
root_window.unbind("bracketleft")
root_window.unbind("bracketright")
bind_axis("Left", "Right", 2) #works
bind_axis("Up", "Down", 1) #works
bind_axis("Pg Up", "Pg Dn", 0)
bind_axis("4", "6", 3)
bind_axis("3", "9", 2)

#0=X 1=Y 2=Z 3=B 4=C

# the rough example i use in my usercommand file, but for our purpose it will work
#  uncomment the keys you want and make the changes
#  there are more keys than i have listed , easy but not too easy

#  ### UNBIND
#root_window.unbind("l")#, commands.toggle_override_limits)
#root_window.unbind("o")#, commands.open_file)
#root_window.unbind("s")#, commands.task_resume)
#root_window.unbind("t")#, commands.task_step)
#root_window.unbind("p")#, commands.task_pause)
#root_window.unbind("R")#, commands.task_reverse)
#root_window.unbind("F")#, commands.task_forward)
#root_window.unbind("v")#, commands.cycle_view)
#root_window.unbind("r")#, commands.task_run)
#root_window.unbind("B")#, commands.brake_on)
#root_window.unbind("b")#, commands.brake_off)
#root_window.unbind("x")#, lambda event: activate_ja_widget("x"))
#root_window.unbind("y")#, lambda event: activate_ja_widget("y"))
#root_window.unbind("z")#, lambda event: activate_ja_widget("z"))
#root_window.unbind("a")#, lambda event: activate_ja_widget("a"))
#root_window.unbind("c")#, lambda event: jogspeed_continuous())
#root_window.unbind("d")#, lambda event: widgets.rotate.invoke())
#root_window.unbind("i")#, lambda event: jogspeed_incremental())
#root_window.unbind("I")#, lambda event: jogspeed_incremental(-1))
#root_window.unbind("`")#, lambda event: activate_ja_widget_or_set_feedrate(0))
#root_window.unbind("1")#, lambda event: activate_ja_widget_or_set_feedrate(1))
#root_window.unbind("2")#, lambda event: activate_ja_widget_or_set_feedrate(2))
#root_window.unbind("3")#, lambda event: activate_ja_widget_or_set_feedrate(3))
#root_window.unbind("4")#, lambda event: activate_ja_widget_or_set_feedrate(4))
#root_window.unbind("5")#, lambda event: activate_ja_widget_or_set_feedrate(5))
#root_window.unbind("6")#, lambda event: activate_ja_widget_or_set_feedrate(6))
#root_window.unbind("7")#, lambda event: activate_ja_widget_or_set_feedrate(7))
#root_window.unbind("8")#, lambda event: activate_ja_widget_or_set_feedrate(8))
#root_window.unbind("9")#, lambda event: activate_ja_widget_or_set_feedrate(9))
#root_window.unbind("0")#, lambda event: activate_ja_widget_or_set_feedrate(10))
#root_window.unbind("!")#, "set metric [expr {!$metric}]; redraw")
#root_window.unbind("@")#, commands.toggle_display_type)
#root_window.unbind("#")#, commands.toggle_coord_type)
#root_window.unbind("$")#, commands.toggle_teleop_mode)
#root_window.unbind("&lt;Home&gt;")#, commands.home_joint)
#root_window.unbind("&lt;End&gt;")#, commands.touch_off_system)
#root_window.unbind(".")#, commands.toggle_coord_type)
#root_window.unbind(",")#, commands.toggle_teleop_mode)
#root_window.unbind(";")#, commands.toggle_coord_type)
#root_window.unbind("'")#, commands.toggle_teleop_mode)
    

#########bind
#root_window.bind("l", commands.toggle_override_limits)
#root_window.bind("o", commands.open_file)
#root_window.bind("s", commands.task_resume)
#root_window.bind("t", commands.task_step)
#root_window.bind("p", commands.task_pause)
#root_window.bind("R", commands.task_reverse)
#root_window.bind("F", commands.task_forward)
#root_window.bind("v", commands.cycle_view)
#root_window.bind("r", commands.task_run)
#root_window.bind("B", commands.brake_on)
#root_window.bind("b", commands.brake_off)
#root_window.bind("x", lambda event: activate_ja_widget("x"))
#root_window.bind("y", lambda event: activate_ja_widget("y"))
#root_window.bind("z", lambda event: activate_ja_widget("z"))
#root_window.bind("a", lambda event: activate_ja_widget("a"))
#root_window.bind("c", lambda event: jogspeed_continuous())
#root_window.bind("d", lambda event: widgets.rotate.invoke())
#root_window.bind("i", lambda event: jogspeed_incremental())
#root_window.bind("I", lambda event: jogspeed_incremental(-1))
#root_window.bind("`", lambda event: activate_ja_widget_or_set_feedrate(0))
#root_window.bind("1", lambda event: activate_ja_widget_or_set_feedrate(1))
#root_window.bind("2", lambda event: activate_ja_widget_or_set_feedrate(2))
#root_window.bind("3", lambda event: activate_ja_widget_or_set_feedrate(3))
#root_window.bind("4", lambda event: activate_ja_widget_or_set_feedrate(4))
#root_window.bind("5", lambda event: activate_ja_widget_or_set_feedrate(5))
#root_window.bind("6", lambda event: activate_ja_widget_or_set_feedrate(6))
#root_window.bind("7", lambda event: activate_ja_widget_or_set_feedrate(7))
#root_window.bind("8", lambda event: activate_ja_widget_or_set_feedrate(8))
#root_window.bind("9", lambda event: activate_ja_widget_or_set_feedrate(9))
#root_window.bind("0", lambda event: activate_ja_widget_or_set_feedrate(10))
#root_window.bind("!", "set metric [expr {!$metric}]; redraw")
#root_window.bind("@", commands.toggle_display_type)
#root_window.bind("#", commands.toggle_coord_type)
#root_window.bind("$", commands.toggle_teleop_mode)
#root_window.bind("&lt;Home&gt;", commands.home_joint)
#root_window.bind("&lt;End&gt;", commands.touch_off_system)




####################################################
#       this is the very slick keybinding thing used in plasmac2
#       posted for reference only

# ~ def keyboard_bindings(state):
    # ~ if firstRun:
        # ~ set_help_text()
    # ~ # delete kb shortcuts from help menu
    # ~ rC('.menu.help','delete',3,5)
    # ~ # remove current bindings
    # ~ for key in root_window.bind():
        # ~ root_window.unbind(key)
    # ~ # create new key bindings if enabled
    # ~ if state:
        # ~ # Escape
        # ~ root_window.bind('&lt;Escape&gt;', commands.task_stop)
        # ~ # F keys
        # ~ root_window.bind_class('all', '&lt;Key-F1&gt;', commands.estop_clicked)
        # ~ root_window.bind('&lt;Key-F2&gt;', commands.onoff_clicked)
        # ~ root_window.bind('&lt;Key-F3&gt;', pane_top + '.tabs raise manual')
        # ~ root_window.bind('&lt;Key-F4&gt;', commands.next_tab)
        # ~ root_window.bind('&lt;Key-F5&gt;', pane_top + '.tabs raise mdi')
        # ~ root_window.bind('&lt;Key-F5&gt;', '+' + tabs_mdi + '.command selection range 0 end')
        # ~ root_window.bind('&lt;Key-F9&gt;', commands.manual_cut)
        # ~ # axis selection
        # ~ root_window.bind('x', lambda event: activate_ja_widget('x'))
        # ~ root_window.bind('y', lambda event: activate_ja_widget('y'))
        # ~ root_window.bind('z', lambda event: activate_ja_widget('z'))
        # ~ root_window.bind('a', lambda event: activate_ja_widget('a'))
        # ~ root_window.bind('b', lambda event: activate_ja_widget('b'))
        # ~ #jogging
        # ~ root_window.bind('c', lambda event: jogspeed_continuous())
        # ~ root_window.bind('i', lambda event: jogspeed_incremental())
        # ~ root_window.bind('I', lambda event: jogspeed_incremental(-1))
        # ~ bind_axis('Left', 'Right', 0)
        # ~ bind_axis('Down', 'Up', 1)
        # ~ bind_axis('Next', 'Prior', 2)
        # ~ bind_axis('KP_Left', 'KP_Right', 0)
        # ~ bind_axis('KP_Down', 'KP_Up', 1)
        # ~ bind_axis('KP_Next', 'KP_Prior', 2)
# ~ #        bind_axis('KP_4', 'KP_6', 0)
# ~ #        bind_axis('KP_2', 'KP_8', 1)
# ~ #        bind_axis('KP_3', 'KP_9', 2)
        # ~ bind_axis('bracketleft', 'bracketright', 3)
        # ~ bind_axis('semicolon', 'quoteright', 4)
        # ~ root_window.bind('&lt;Key-KP_Add&gt;', lambda event: commands.key_pressed('jogfast'))
        # ~ root_window.bind('&lt;KeyRelease-KP_Add&gt;', lambda event: commands.key_released('jogfast'))
        # ~ root_window.bind('&lt;Key-KP_Subtract&gt;', lambda event: commands.key_pressed('jogslow'))
        # ~ root_window.bind('&lt;KeyRelease-KP_Subtract&gt;', lambda event: commands.key_released('jogslow'))
        # ~ # sliders
        # ~ root_window.bind('`', lambda event: activate_ja_widget_or_set_feedrate(0))
        # ~ root_window.bind('&lt;Control-Key-quoteleft&gt;',lambda event: set_rapidrate(0))
        # ~ root_window.bind('&lt;Alt-Key-quoteleft&gt;',lambda event: set_jog_slider(0.0))
        # ~ for n in range(10):
            # ~ rate = n if n &gt; 0 else 10
            # ~ root_window.bind('{}'.format(n), make_lambda(activate_ja_widget_or_set_feedrate, rate))
            # ~ root_window.bind('&lt;Control-Key-{}&gt;'.format(n), make_lambda(set_rapidrate, rate * 10))
            # ~ root_window.bind('&lt;Alt-Key-{}&gt;'.format(n), make_lambda(set_jog_slider, rate * 0.1))
        # ~ # homing
        # ~ if homing_order_defined:
            # ~ root_window.bind('&lt;Control-Home&gt;', commands.home_all_joints)
        # ~ else:
            # ~ root_window.bind('&lt;Control-Home&gt;', commands.home_joint)
        # ~ root_window.bind('&lt;Shift-Home&gt;', commands.home_joint)
        # ~ # touchoff
        # ~ root_window.bind('&lt;Key-End&gt;', lambda event: commands.touch_off_xy('1', 0, 0))
        # ~ root_window.bind('&lt;KeyRelease-End&gt;', lambda event: commands.touch_off_xy('0', 0, 0))
        # ~ root_window.bind('&lt;Control-End&gt;', commands.set_axis_offset)
        # ~ root_window.bind('&lt;Shift-End&gt;', commands.touch_off_system)
        # ~ root_window.bind('&lt;Key-Delete&gt;', lambda event: commands.key_pressed('Delete'))
        # ~ root_window.bind('&lt;KeyRelease-Delete&gt;', lambda event: commands.key_released('Delete'))
        # ~ # program
        # ~ root_window.bind('o', commands.open_file)
        # ~ root_window.bind('r', commands.task_run)
        # ~ root_window.bind('p', commands.task_pause)
        # ~ root_window.bind('&lt;space&gt;', commands.task_pause)
        # ~ root_window.bind('s', commands.task_resume)
        # ~ root_window.bind('&lt;Control-r&gt;', commands.reload_file)
        # ~ root_window.bind('&lt;Control-s&gt;', commands.save_gcode)
        # ~ # clearing 
        # ~ root_window.bind('&lt;Control-k&gt;', commands.clear_live_plot)
        # ~ root_window.bind('&lt;Control-space&gt;', lambda event: notifications.clear())
        # ~ # whacky keypad stuff
        # ~ keys1 = ['Decimal', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
        # ~ # Down, Next, Left, Right, Up, and Prior are done in the jogging section above
        # ~ keys2 = ['Delete', 'Insert', 'End', None, None, None, 'Begin', None, 'Home', None, None]
        # ~ for k in range(len(keys2)):
            # ~ if keys2[k]:
                # ~ root_window.bind('&lt;Key-KP_{}&gt;'.format(keys2[k]), make_lambda(key_pressed, keys2[k]))
                # ~ root_window.bind('&lt;KeyRelease-KP_{}&gt;'.format(keys2[k]), make_lambda(key_released, keys2[k]))
                # ~ root_window.bind('&lt;Mod2-KeyRelease-KP_{}&gt;'.format(keys2[k]), make_lambda(key_released, keys1[k]))
        # ~ # add kb shortcuts to help menu
        # ~ rC('.menu.help','add','separator')
        # ~ rC('.menu.help','add','command','-command','wm transient .keys .;wm deiconify .keys; focus .keys.ok')
        # ~ rC('setup_menu_accel','.menu.help','end',_('Keyboard Shortcuts'))
        # ~ rC('.menu.help','add','command','-command','wm transient .keyp .;wm deiconify .keyp; focus .keyp.ok')
        # ~ rC('setup_menu_accel','.menu.help','end',_('Keypad Shortcuts'))
    # ~ # use arrow buttons for spinboxes
    # ~ for item in rpList + cpList:
        # ~ widget = item[0] + '.' + item[1]
        # ~ rC('bind',widget,'&lt;Up&gt;','%W invoke buttonup')
        # ~ rC('bind',widget,'&lt;Down&gt;','%W invoke buttondown')
        # ~ rC('bind',widget,'&lt;Left&gt;','::tk::EntrySetCursor %W [expr {[%W index insert] - 1}]')
        # ~ rC('bind',widget,'&lt;Right&gt;','::tk::EntrySetCursor %W [expr {[%W index insert] + 1}]')
</pre></body></html>