How can I create a GUI on top of a Python APP so it can do either GUI or CLI?

前端 未结 4 1072
北海茫月
北海茫月 2021-01-01 07:17

I am trying to write an app in python to control a motor using serial. This all works in a CLI situation fine and is generally stable. but I was wondering how simple it was

4条回答
  •  情深已故
    2021-01-01 07:59

    Well, what I do is that I have a one and only bash script with the following:

    if [ "${0}" == "mcm" ]; then
        /usr/bin/python ${inst_dir}/terminal/mcm-terminal.py ${@}
    else
        /usr/bin/python ${inst_dir}/gtk/mcm-gtk.py &
    fi
    

    Then I create two symlinks: /usr/sbin/mcm and /usr/bin/mcm-gtk

    Works very nice.

提交回复
热议问题