dlg_callback()

Sets a callback function to be executed when the “Apply,” “OK,” or “Close” button is clicked in a dialog.

Syntax

planetcnc.dlg_callback(handle, callback)

Parameters

Parameter Type Description Comment
handle string Handle of the dialog to set the callback for.
callback function Function to be executed when a button is clicked.

Return Value

Examples

#! /usr/bin/env python
 
import planetcnc
 
# Define a callback function
def on_dialog_action():
    print("Dialog button clicked!")
 
# Set the callback for a specific dialog
dialog_handle = "MyDialogHandle"
planetcnc.dlg_callback(dialog_handle, on_dialog_action)
 
print("Callback function set.")

See also

dlg_new
dlg_init
dlg_update
dlg_clear

dlg_show
dlg_run
dlg_abort

dlg_is_valid
dlg_keep_open
dlg_callback