Know any creative ways to interface Python with Tcl?

前端 未结 3 1605
轻奢々
轻奢々 2020-12-08 21:24

Here\'s the situation. The company I work for has quite a bit of existing Tcl code, but some of them want to start using python. It would nice to be able to reuse some of

3条回答
  •  借酒劲吻你
    2020-12-08 21:58

    I hope you're ready for this. Standard Python

    import Tkinter
    tclsh = Tkinter.Tcl()
    tclsh.eval("""
        proc unknown args {puts "Hello World!"}
        }"!dlroW olleH" stup{ sgra nwonknu corp
    """)
    

    Edit in Re to comment: Python's tcl interpreter is not aware of other installed tcl components. You can deal with that by adding extensions in the usual way to the tcl python actually uses. Here's a link with some detail

    • How Tkinter can exploit Tcl/Tk extensions

提交回复
热议问题