...
This script creates a button inside a window. When you click this button a new information window will pop up, saying "Hello World!".
No Formatpanel | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
h5. Start a new script
# Create toplevel window
set w [qwidget ]
| ||||||||||||
This will create a new empty text editor where the graphics window used to be. |
...
Let us go through the script in detail. First we need a toplevel window that will contain the button. Type in:
No Format | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
# Create toplevel window
set w [qwidget ]
|
A window in QTcl is an instance of a QWidget object, hence the command name. It may be followed by a list of flags. Although rarely used, the flags can be used to modify the widgets look and behaviour. The next statement tells QTcl to delete the widget from memory when it is closed:
...