GraphicsWindow Class Reference

« | ReferenceGuide | GraphicsCanvas »

This class defines a basic top level window that can be opened on the desktop and used to produce simple graphical drawings. It contains a canvas on which geometric shapes can be drawn and manipulated.

Public Methods

GraphicsWindow()
Creates a new graphics window with a canvas that has a default size.
GraphicsWindow(width, height)
Creates a new graphics window with a canvas of the given size.
canvas()
Returns a reference to the canvas contained within the window.
close()
Closes and destroys the window.
hide()
Hides or iconifies the top level window.
isValid()
Returns a Boolean indicating whether the window associated with the object exist and is valid.
quit()
Terminates the event loop.
setTitle(title)
Sets the title of the window.
show()
Shows or deiconifies a previously hidden top level window.
wait()
Starts the event loop that processes various window events.

Detailed Description

GraphicsWindow()
Creates a new graphics window with a canvas that has a default size. The canvas contained in the window is initially empty with a white background. It is created with a default size of 400 x 400.
GraphicsWindow(width, height)
Creates a new graphics window with a canvas of the given size. The canvas contained in the window is initially empty with a white background. The size of the canvas will be set to the size specified by width and height.
Parameters:
width
The horizontal size of the canvas in pixels.
height
The vertical size of the canvas in pixels.
canvas()
Returns a reference to the canvas contained within the window. The canvas can be used to draw and manipulate geometric shapes and text.
Returns:
A reference to the GraphicsCanvas contained in the window.
wait()
Starts the event loop that processes various window events. This causes the sequential execution of the program to stop and wait for the user to click the close button on the main window or to call the quit() method on any window. This method should only be called on the main window.
setTitle(title)
Sets the title of the window. The title is displayed in the title bar of the top-level window. By default, the window has no title.
Parameters:
title
A text string to which the title of the window is set. To remove the title, pass an empty string to the method.
isValid()
Returns a Boolean indicating whether the window associated with the object exist and is valid. The object of an invalid window, which normally results from being closed, can not be used.
Returns:
True if the window is valid or False otherwise.
quit()
Terminates the event loop. When the event loop terminates, the program will continue execution at the point immediately after the call to the wait method.
close()
Closes and destroys the window. The object still exist, but the window is not valid and can not be used.
hide()
Hides or iconifies the top level window. The window still exists and can be displayed again using the show() method.
show()
Shows or deiconifies a previously hidden top level window.


« | ReferenceGuide | GraphicsCanvas »

Last modified: October 12, 2014, at 08:01 PM.