WsWindow:
Filter:
WsGUI/Classes (extension) | GUI > WsGUI | Extensions

WsWindow
ExtensionExtension

WebSocket-based GUI for SuperCollider

Description

WsWindow is a representation of a single webpage for drawing GUI elements. It can be accessed from a web browser locally and over the network. WsWindow and WsWidgets aims to have an API as close as possible to SC's GUI classes.

WsWindow uses a node.js script to serve dynamic webpages. This script is controlled internally by the WsWindowServer class.

NOTE: If using this code over the internet, please be advised that it was not tested for security or reliability with many clients connected at once.
NOTE: The API of WsWindow has changed after Quark version 0.1.

Credits: This software was developed by Marcin Pączkowski and Michael McCrea with the support of the Center for Digital Arts and Experimental Media (DXARTS) at the University of Washington.

Class Methods

.new

Starts a new web-based Window to draw GUI elements on.

Arguments:

title

Window's title, used for both title text in the browser's frame/tab, as well as the portion of the address.

NOTE: Please don't use characters that are not filename-safe (like #^/\ etc). Spaces are allowed and will be removed in the window's address.
wwwPort

Specify the port at which the page will be served.

isDefault

If true, client's browser will be redirected to this window automatically when connecting to http://yourIP:wwwPort. If false, then list of available windows will be presented instead.

suppressPosting

If true, then messages from the websocket server will not post to SC's post window.

Returns:

An instance of WsWindow

.freeAll

Close/free all open instances of WsWindow (useful in case of accidentally re-running a code block that instantiates new WsWindows). This will also close the node server, if running.

Instance Methods

.free

Free this instance of the WsWindow.

.close

Same as -free.

.clear

Removes all GUI elements from the WsWindow (but does not close/free it).

.background

Set/get the background color.

Arguments:

color

Should be an instance of a Color.

.isDefault

Sets or un-sets this WsWindow as default. Also see *new.

Arguments:

val

true or false

.title

Set/get window title. Also see *new.

Arguments:

title

New title.

.backgroundBlink

If freq > 0, the background will alternate between the two defined colors. To stop alternatting between colors, set freq to 0 or use -background.

Examples