Put the following code into the on_click action of a button:
Example 5.14. Loading a file content into a field
filename=hk_this.show_filedialog()
file=open(filename)
data=file.read()
datafield=hk_thisform.get_pyvisible("datafield")
datafield.set_value(data)
This example lets the user select a file(line 1) and load its content (line 2 and 3) into a field (line 4 and 5).