Using Python functions in Tkinter.Tcl()

后端 未结 2 953
南方客
南方客 2021-01-03 09:55
  1. I have a bunch of Python functions. Let\'s call them foo, bar and baz. They accept variable number of string arguments and do

2条回答
  •  [愿得一人]
    2021-01-03 10:11

    @Brian - I had to experiment in order to get the right result

    from Tkinter import Tcl
    tcl = Tcl()
    result = tcl.eval(' puts "hello, world" ')
    

    Note the placement of the single and double quotes. This gave me the expected output: hello, world

    Any other combinations of single or double quotes resulted in the following traceback:

      File "", line 1, in 
    _tkinter.TclError: can not find channel named "hello,"
    

    --- fracjackmac

提交回复
热议问题