Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This script creates a button inside a window. When you click this button a new information window will pop up, saying "Hello World!".

h5. Start a new script # Create toplevel window set w [qwidget ]
No Formatpanel
borderColor#404040
bgColor#F0F0F0
borderWidth1
borderStyledashed
titleStart a new script
borderStyledashed
  • Click File > New > Text Editor

This will create a new empty text editor where the graphics window used to be.

...

panel

Let us go through the script in detail. First we need a toplevel window that will contain the button. Type in:

No Format
borderColor#404040
bgColor#F0F0F0
borderWidth1
titleCreate a toplevel window
borderStyledashed

# 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:

...