Native GUI Subsystem (`gui`)
Build lightweight desktop user interfaces with native OS windows, buttons, text inputs, labels, and dialog boxes directly from PyLua.
1. Creating a GUI Window
gui_window.lua
import gui
win = gui.Window("PyLua Tool Manager", 450, 300)
win:addLabel("Welcome to PyLua Native UI!", 20, 20, 300, 30)
inputField = win:addInput(20, 60, 250, 25)
win:addButton("Click Me", 20, 100, 120, 35, function() {
win:alert("Hello from PyLua!", "Event Triggered")
})
win:show()
2. GUI Controls Reference
| Method | Signature | Description |
|---|---|---|
gui.Window(title, w, h) |
(str, int, int) → Window |
Creates a top-level native OS window. |
win:show() |
() → void |
Displays the window and enters the native UI message event loop. |
win:addButton(text, x, y, w, h, callback) |
(str, int, int, int, int, func) → Button |
Renders a clickable button that triggers callback when pressed. |
win:addInput(x, y, w, h) |
(int, int, int, int) → Input |
Renders an editable text field for user input. |
win:addLabel(text, x, y, w, h) |
(str, int, int, int, int) → Label |
Displays static text label on the window surface. |
win:alert(message, [title]) |
(str, [str]) → void |
Opens a modal system message box alert dialog. |