Hello World

A simple "hello world" script to test the bipscript-fltk extension.

To use the extension we need to import the Fltk package:


import Fltk


Create a top level window with initial size.


local window = Fltk.Window(340, 140)

Create a box widget. Most widget constructors follow this same pattern, with location, size and an optional label.


local box = Fltk.Box(20, 20, 300, 100, "Hello, World!")

Note that all widgets created after the window will be added to that window, until the window end() method is called.

Set the box type and some attributes for the label:


box.box = Fltk.Boxtype.UP_BOX
box.labelfont = Fltk.Font.BOLD + Fltk.Font.ITALIC
box.labelsize = 36
box.labeltype = Fltk.Labeltype.SHADOW_LABEL 

Don't forget to call the window end() method after adding all child widgets!


window.end()

Show the window and run the application:


window.show()

Fltk.run();



Complete Script

import Fltk

local window = Fltk.Window(340, 140)

local box = Fltk.Box(20, 20, 300, 100, "Hello, World!")

box.box = Fltk.Boxtype.UP_BOX
box.labelfont = Fltk.Font.BOLD + Fltk.Font.ITALIC
box.labelsize = 36
box.labeltype = Fltk.Labeltype.SHADOW_LABEL

window.end()

window.show()

Fltk.run();


List of All Examples
Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.