Skip to content

Python Thread

joern274 edited this page Sep 21, 2022 · 3 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: 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.

Clone this wiki locally