Lynx.@app — Macro@app() -> LynxAppReturns the current LynxApp or throws an exception if no LynxApp has been created.
Lynx.@canvas — Macro@canvas() -> CanvasReturns the current Canvas.
Lynx.@framerate — Macro@framerate() -> Float64Returns the current framerate.
Lynx.@height — Macro @height -> IntThe height of the current canvas.
Lynx.@on — Macro @on widget.event() do args... body... endAdds a event callback to the corresponding widget
Usage
@on window.destroy() do args...
# do something when the window is destroyed
end
@on button.clicked() do args...
# do something when the button is clicked
end
Lynx.@size — Macro @size -> Tuple{Int, Int}The width and height of the current canvas.
Lynx.@use — Macro @use widgetAdds the widget to the current application and returns it.
Lynx.@waitfor — Macro @waitfor widget.eventBlock the current task until the event is triggered for widget.
Examples:
window = Window("Hello, world", 800, 600)
... # Some UI stuff
if !isinteractive()
# If the code is not running on a interactive julia session
# (e.g. the REPL), then the line below will block the current
# task until the window is destroyed
@waitfor window.destroy
endLynx.@width — Macro @width -> IntThe width of the current canvas.
Lynx.@window — Macro@window() -> WindowReturns the current window.
Base.fill! — Method fill!(bar::ProgressBar, fraction::Real) -> NothingCauses the progress bar to “fill in” the given fraction of the bar. The fraction should be between 0.0 and 1.0, inclusive.
Lynx.CanvasOnly — MethodThe canvas is the only widget and fills the entire window.
Lynx.cspan — Method cspan(columns) -> GridElementCreates a empty GridElement that spans multiple columns
Lynx.framerate! — Methodframerate!(x::Real)Sets the current framerate.
Lynx.gcpreserve — Methodgcpreserve(widget::GtkWidget, obj)Preserve obj until widget has been destroyed.
Lynx.init — Method init(title, width, height; layout = CanvasOnly) -> LynxAppCreates a new LynxApp.
Lynx.layout! — Methodlayout!(layout::Function)Sets the current layout.
Lynx.loop! — Methodloop!(x::Bool)Whether or not the update function should be called every frame.
Lynx.mapr — Method mapr(t, a, b, c, d) -> RealMaps the value t from the interval [a, b] to [c, d]
Lynx.mapr — Method mapr(t, a, b) -> RealMaps the value t from the interval [0, 1] to [a, b]
Lynx.onmousedown — Method onmousedown(callback, canvas)The mouse-down event is fired when the user press with the mouse on the canvas.
Lynx.onmousedrag — Method onmousedrag(callback, canvas)The mouse-drag event is fired when the user holds down and move the cursor on the canvas.
Lynx.onmousemove — Method onmousemove(callback, canvas)The mouse-move event is fired when the user moves the cursor on the canvas.
Lynx.onmouseup — Method onmouseup(callback, canvas)The mouse-up event is fired when the user release the mouse on the canvas.
Lynx.onscroll — Method onscroll(callback, canvas)The scroll event is fired when the user scrolls with the mouse-wheel on the canvas.
Lynx.pulse! — Method pulse!(widget::ProgressBar) -> NothingMake the progress bar pulse, indicating that a unknown amount of progress has been made.
Lynx.rspan — Method rspan(rows) -> GridElementCreates a empty GridElement that spans multiple rows
Lynx.run! — Function run!(update::Function [, setup::Function]; await = false) -> NothingRun the current LynxApp with the given update function. If await is true, the main task will be blocked until the user closes the window.
You can also specify a setup function that will be called when the window is created.
Lynx.span — Method span(rows, cols) -> GridElementCreates a empty GridElement that spans multiple rows and cols.
Lynx.span — Method span(; rows = 1, cols = 1) -> GridElementCreates a empty GridElement that spans multiple rows and cols.
Lynx.use! — Method use!(widget) -> WidgetAdds the widget to the current application and returns it.
Lynx.value! — Method value!(widget::Input, value) -> NothingSets the value of a Input widget.
Lynx.value — Method value(widget::Input{T}) -> TReturns the value of a Input widget.
Lynx.AbstractLayout — TypeLayouts are used to organize the canvas and other widgets within the window.
They are simple function or callable structures.
Example of layout implementation:
struct MyLayout <: AbstractLayout
fields...
function MyLayout(args...)
...
end
end
function (layout::MyLayout)(window, canvas, widgets...)
...
endThe call implementation of a layout should return a widget that contains (or not) the canvas and the widgets. The returned widget will then be added to the window.
Lynx.Box — TypeA container used to pack widgets together.
Lynx.Box — Method Box(direction, children...; props...) -> BoxCreates a Box widget.
The direction parameter determines the direction the widgets are packed. :v for vertical or :h for horizontal.
Lynx.Button — TypeA widget that emits a signal when clicked on
Lynx.CheckBox — TypeCreate widgets with a discrete toggle button
Lynx.ColorButton — TypeA button to launch a color selection dialog
Lynx.Dropdown — MethodA widget used to choose from a list of items
Lynx.Frame — TypeA bin with a decorative frame and optional label
Lynx.GLArea — TypeCustom drawing with OpenGL.
Lynx.Grid — TypeA container for displaying widgets in a grid.
Lynx.Grid — Method Grid(rows::Vector; props...) -> GridCreates a Grid and adds to it each element in rows.
The rows argument must be a list of Vector{<:Widget}. The position of each element in rows determines its position within the grid.
You can also use GridElement to make widgets span multiple cells within the grid.
Example:
grid = Grid(
Label("A"), Label("B"), |,
Label("C"), Label("D"), |,
Label("E") |> span(cols=2), |,
)Lynx.GridElement — TypeRepresents a grid element that may span multiple rows and/or columns.
You can use the span function to create a empty GridElement.
Calling a empty GridElement as a function and passing a Widget as argument will transform that widget into a GridElement, making it span multiple cells in a Grid container.
Usage:
grid = Grid([
# The Button will span 3 columns
[Button("Example 1") |> span(cols=3)],
# The Button will span 2 rows
[Button("Example 2") |> span(rows=2)],
# The Button will span an 2 rows and 3 columns
[Button("Example 3") |> span(2, 3)],
])Lynx.ImageView — TypeA widget for displaying an image.
Lynx.Label — TypeA widget that displays a small to medium amount of text
Lynx.LynxApp — TypeAn LynxApp is a basic structure that holds a window, a canvas and other widgets to make a interactive application with a few lines of code.
Lynx.Paned — TypeA widget with two adjustable panes.
Lynx.Paned — Method Paned(direction, children...; props...) -> PanedCreates a Paned widget.
The direction parameter determines how the two panes are arranged, either horizontally :h, or vertically :v.
Lynx.ProgressBar — TypeA widget which indicates progress visually
Use the fill! and the pulse! functions to control the progress bar.
Lynx.Scrolled — TypeAdds scrollbars to its child widget.
Lynx.Scrolled — Method Scrolled(children::Widget...; props...) -> ScrolledCreates a Scrolled widget.
Lynx.SideBar — TypeThe SideBar layout divides the window between the canvas and a sidebar containing the other widgets.
Lynx.SideBar — Type SideBar(position = :left, size = .25, props = NamedTuple()) -> SideBarCreates a SideBar layout. The position determines where the sidebar is placed relative to the canvas (can be either :left or :right). The size controls the width of the sidebar relative to the width of the window (must be a value between 0 and 1). You can also pass aditional properties for the sidebar widget using the props parameter.
Lynx.Slider — TypeA slider widget for selecting a value from a range
Lynx.SpinButton — TypeRetrieve an integer or floating-point number from the user
Lynx.Switch — TypeA “light switch” style toggle
Lynx.TextField — TypeA single line text entry field.
Lynx.ToggleButton — TypeCreate buttons which retain their state