Tcl/Tk examples?

前端 未结 4 515
滥情空心
滥情空心 2020-12-08 11:40

Tcl/Tk is a simple way to script small GUIs.

Can anyone give a nice example with a button and a text widget. When the button is pressed should a sh

4条回答
  •  Happy的楠姐
    2020-12-08 12:35

    Some suggestions:

    To append the output to the text widget, instead of specifying line 999999, you can use the index end, which refers to the position just after the last newline. For example,

    .main insert end "$x\n"
    

    To have the text scroll as the command is outputting, use the see command. For example, after appending to the .main text widget

    .main see end
    

    You may also want to consider grabbing the command output asynchronously, by using the fileevent command.

提交回复
热议问题