📄 api.txt
字号:
This file outlines the commands that are available inthe eventutils package.--------------------------------------------------close_toplevel { widget }This command will close the toplevel window givenas the widget argument.Example: Query for next toplevel and then close it.set top [next_toplevel]close_toplevel $top--------------------------------------------------mouse_click { widget args }This command uses the "event generate" commandto simulate a user clicking the mouse overthe given widget. Optional arguments can includeany valid options to the "event generate" command,the most common of which are -x and -y to indicatethe x and y coords of the mouse click.Example:set top [next_toplevel]set button $top.openmouse_click $button--------------------------------------------------mouse_double_click { widget args }This command works just like mouse_click exceptthat it generates a double click event insteadof a regular click.FIXME: Do we need a mouse_triple_click ?--------------------------------------------------pause {{msecs 1000}}This command will pause the execution of thescript for a given number of (1/1000) secondintervals. This can be useful in cases whereyou know that some amount of delay is needed.If invoked with no arguments, it will pausefor one second.Example: Pause script for 5 seconds, then destroyset top [next_toplevel]pause 5000close_toplevel $top--------------------------------------------------writefile { file data }This command will write the given buffer of datato the file named "file". This command istypically used to create files that will beloaded into a project or some such thing.If the file already exists it will be truncated.The directory where the file will live mustalready exist.Example: Create some source files in /tmp/foofile delete -force /tmp/foofile mkdir /tmp/foowritefile /tmp/foo/f1.c {int func1(int i) { return 0; }}writefile /tmp/foo/f2.c {int func2(int i) { return func1(0); }}--------------------------------------------------enter_text { widget text }This command is used to enter text into a widget.The exact way that text is entered depends on thewidget in question. In general, one can assumethat text that was already in the widget getserased before new text is added.Example: Enter some text into an Entry widgetset top [next_toplevel]set entry $top.entryenter_text $entry HELLO--------------------------------------------------listbox_select_index { lb index }This command will select a numerical indexin a listbox widget. If the numerical indexis bigger than the number of elements, thenan error will be raised. The mouse_clickcommand is used behind the scenes to actuallyselect the index, so as to simulate the useractually clicking on the given index in the list.Example: Highlight the first element in the listboxset top [next_toplevel]set lb $top.listboxlistbox_select_index $lb 0--------------------------------------------------listbox_select_entry_pattern {lb pattern}This command works like the listbox_select_indexcommand except that instead of providing anumerical index, one would provide a patternthat matches the item in the listbox thatyou would like to select.Example: Highlight an entry that matched Foo*set top [next_toplevel]set lb $top.listboxlistbox_select_entry_pattern $lb Foo*--------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -