-
Notifications
You must be signed in to change notification settings - Fork 98
Python Thread
julianspeith edited this page Aug 17, 2026
·
4 revisions
Users might want to test this highly experimental feature in branch v4.0.0. The Python interpreter (regardless whether called from script or console) will run in background thread. Doing so we can implement the following features:
- Scripts or commands can be aborted when entering an infinite loop or consuming to much time
- The build-in commands input() and raw_input() get input from console rather than from stdin
- There are new gui_input features available. The Python programmer can invoke a GUI input dialog or a graphical module/gate picker.
Have a look at the demo (duration 3:42 min) : https://user-images.githubusercontent.com/67793777/191590033-4c3e9984-5813-4a67-af23-076f543c259d.mp4
Disclaimer: right now there is no whatsoever code protecting the netlist against simultaneous access from Python interpreter and GUI at the same time which will cause unpredictable results or crash hal. To make netlist access thread safe will be a goal for future development.
- Python Console Widget and Python Editor Widget — the two places the interpreter runs from
- Python GUI API — the GUI functions, including the input dialogs mentioned above
- Building HAL — building the branch this feature lives on