API Reference
Application
Application and window management, JS bridge, and file dialogs.
- class iskg.app.Application(title: str = 'ISKG App', width: int = 800, height: int = 600, scanlines: bool = True, vignette: bool = True, theme: str = 'ifaz', debug: bool = False)[source]
Bases:
objectMain application entry point.
Creates a native window via pywebview, renders all widgets as HTML/CSS/JS, and manages the JS bridge for event handling.
Usage:
app = Application("My App", 800, 600) label = Label(text="Hello") app.add(label) app.run()
Pass
debug=Trueto log JavaScript errors to stderr:app = Application(debug=True)
- add(widget: Widget) Widget[source]
Register a root-level widget with the application.
Widgets must be added to the app before
run()is called.
- color_dialog(title: str = 'Choose Color', initial_color: str = '#000000') str | None[source]
Open a color picker dialog.
Uses GTK on Linux, falls back to a browser
<input type="color">on Windows/macOS.Returns a hex string (e.g.
"#ff8800") orNone.
- property debug: bool
- execute_js(js_code: str) Application[source]
Execute arbitrary JavaScript in the webview window.
- file_dialog(dialog_type: str = 'open', directory: str = '', file_types: list[str] | None = None, allow_multiple: bool = False) Any | None[source]
Open a native OS file dialog.
Uses GTK directly (same toolkit as pywebview underneath) with explicit dialog sizing. Falls back to pywebview’s built-in dialog.
- Parameters:
dialog_type –
"open","save", or"folder".directory – starting directory path.
file_types – list of extensions like
["*.txt", "*.py"].allow_multiple – allow multiple file selection (open only).
- font_dialog(title: str = 'Choose Font', initial_font: str = '') dict[str, Any] | None[source]
Open a font picker dialog.
Uses GTK on Linux, falls back to a browser prompt on Windows/macOS.
Returns a dict with keys
family,size,weight,style, orNone.
- geometry(x: int | None = None, y: int | None = None, w: int | None = None, h: int | None = None) tuple[int, int, int, int][source]
Get or set the window position and size.
- register_theme(name: str, overrides: dict[str, str]) Application[source]
Register a new theme for runtime use.
- Parameters:
name – unique theme name (e.g.
"mytheme").overrides – dict of CSS custom properties, e.g.
{"--bg-primary": "#000", "--text": "#fff"}.
- run(extra_js: str = '') None[source]
Open the window and start the application main loop.
Blocks until the window is closed. Redirects GTK stderr warnings to /dev/null during execution.
- Parameters:
extra_js – additional JavaScript to execute on startup (e.g. tooltip init code).
- set_theme(name: str) Application[source]
Switch the UI theme at runtime.
- Parameters:
name – one of
"ifaz","cold","warm","night", or a custom name previously registered viaregister_theme().
- iskg.app.Window
alias of
Application
Base Widget
Base Widget class with layout engines (pack/grid/place), event bindings, style rendering, and widget tree management.
- class iskg.base.Widget(parent: Widget | None = None, **kwargs: Any)[source]
Bases:
objectBase class for all ISKG widgets.
Manages widget identity, parent-child tree, layout configuration, style rendering, event bindings, and bridge communication with the JavaScript frontend.
Every concrete widget (Button, Label, Frame, etc.) inherits from this class.
- after(ms: int, callback: Callable) _Timer[source]
Schedule a function to run after ms milliseconds.
- Parameters:
ms – delay in milliseconds.
callback – function to call (no arguments).
- Returns:
A
_Timerwith.cancel()and.running.
- property app: Any
The Application instance this widget belongs to, or None.
- bind(event: str, callback: Callable) None[source]
Bind a callback to an event.
Supports standard bridge events (
"click","change", etc.), tkinter-style key events ("<KeyPress-a>","<KeyRelease-Return>","<Control-c>","<Key>"), and virtual events ("<<CustomEvent>>").Key event callbacks receive a dict with
key,code,ctrl,alt,shift.
- config(**kwargs: Any) Widget[source]
Configure widget properties.
Accepts any keyword argument; underscores in keys are converted to hyphens for CSS. Common keys:
fg,bg,font_size,padding,border_color,opacity, etc.Also accepts
state("normal","disabled","readonly"),visible(bool),textvariable, andvariablewhich are handled specially.
- property cursor: str
- event_generate(event: str, data: Any = None) bool[source]
Generate a virtual event that bubbles up the parent chain.
- Parameters:
event – event name (e.g.
"<<Custom>>","click","change").data – optional data passed to the callback.
- Returns:
Trueif propagation should stop (callback returned"break").
- focus_set() None
Move keyboard focus to this widget.
- grid(row: int = 0, column: int = 0, rowspan: int = 1, columnspan: int = 1, sticky: str = '', padx: int = 0, pady: int = 0) Widget[source]
Arrange this widget using grid layout.
- Parameters:
row – row index (0-based).
column – column index (0-based).
rowspan – number of rows to span.
columnspan – number of columns to span.
sticky – combination of
"n","s","e","w", or"c"for center.padx – horizontal padding.
pady – vertical padding.
To control row/column weights and minimum sizes, use
grid_columnconfigure()andgrid_rowconfigure()on the parent Frame.
- grid_forget() None[source]
Remove from grid layout (position lost). Call
grid()with new parameters to re-display.
- grid_remove() None[source]
Remove from grid layout, remembering position. Call
grid()with the same parameters to restore.
- property height: int | None
- pack(side: str = 'top', fill: str = 'none', expand: bool = False, padx: int = 0, pady: int = 0, anchor: str = 'nw') Widget[source]
Arrange this widget using pack layout.
- Parameters:
side –
"top","left","bottom", or"right".fill –
"none","x","y", or"both".expand – whether to take extra space.
padx – horizontal padding in pixels.
pady – vertical padding in pixels.
anchor –
"nw","n","ne","w","e","sw","s","se".
- pack_forget() None
Remove from grid layout (position lost). Call
grid()with new parameters to re-display.
- place(x: int = 0, y: int = 0, width: int | None = None, height: int | None = None, anchor: str = 'nw') Widget[source]
Position this widget at absolute coordinates.
- Parameters:
x – left offset in pixels.
y – top offset in pixels.
width – explicit width in pixels, or None for auto.
height – explicit height in pixels, or None for auto.
anchor –
"nw","n","ne","w","e","sw","s","se".
- property state: str
Get the widget state (
"normal","disabled","readonly").
- property takefocus: bool
Whether this widget can receive keyboard focus. Default
Truefor interactive widgets (Button, Entry, etc.),Falsefor containers.
- property tooltip: str
Get/set the hover tooltip text for this widget.
- property visible: bool
Whether the widget is visible.
- property widget_id: str
Unique identifier for this widget instance.
- property width: int | None
Widget Controls
- class iskg.widgets._controls.Button(parent: Widget | None = None, text: str = '', command: Callable | None = None, **kwargs: Any)[source]
Bases:
WidgetA clickable push button with IFAZ tactical styling.
- property text: str
- class iskg.widgets._controls.CheckBox(parent: Widget | None = None, text: str = '', checked: bool = False, command: Callable | None = None, **kwargs: Any)[source]
Bases:
WidgetA toggleable check box with label.
- property checked: bool
- property text: str
- class iskg.widgets._controls.ComboBox(parent: Widget | None = None, values: list[str] | None = None, current: int = 0, command: Callable | None = None, editable: bool = False, **kwargs: Any)[source]
Bases:
WidgetA dropdown select menu.
- property current: int
- property editable: bool
- property value: str
- class iskg.widgets._controls.Entry(parent: Widget | None = None, text: str = '', justify: str = '', maxlength: int | None = None, **kwargs: Any)[source]
Bases:
WidgetA single-line text input field.
- property justify: str
- property maxlength: int | None
- property text: str
- class iskg.widgets._controls.RadioButton(parent: Widget | None = None, text: str = '', group: str = 'default', command: Callable | None = None, value: str = '', variable: Any = None, **kwargs: Any)[source]
Bases:
WidgetA radio button for single-selection within a group.
- property selected: bool
- property text: str
- property value: Any
- class iskg.widgets._controls.Scale(parent: Widget | None = None, value: float = 0.5, command: Callable | None = None, from_: float = 0.0, to: float = 1.0, orient: str = 'horizontal', **kwargs: Any)[source]
Bases:
SliderA range slider with min/max labels.
- class iskg.widgets._controls.Slider(parent: Widget | None = None, value: float = 50, min_value: float = 0, max_value: float = 100, command: Callable | None = None, from_: float = 0, to: float = 100, orient: str = 'horizontal', **kwargs: Any)[source]
Bases:
WidgetA horizontal range slider.
- property value: float
- class iskg.widgets._controls.SpinBox(parent: Widget | None = None, value: int = 0, min_value: int = 0, max_value: int = 100, step: int = 1, command: Callable | None = None, from_: int = 0, to: int = 100, **kwargs: Any)[source]
Bases:
WidgetA numeric stepper with up/down buttons.
- property value: int
Widget Display
- class iskg.widgets._display.IconLabel(parent: Widget | None = None, text: str = '', icon: str = '', icon_size: int = 14, **kwargs: Any)[source]
Bases:
WidgetA label with an inline icon.
- class iskg.widgets._display.ImageBox(parent: Widget | None = None, src: str = '', width: int = 100, height: int = 100, fit: str = 'contain', **kwargs: Any)[source]
Bases:
WidgetA widget that displays an image.
- class iskg.widgets._display.IndicatorLED(parent: Widget | None = None, color: str = 'green', size: int = 8, active: bool = True, label: str = '', **kwargs: Any)[source]
Bases:
WidgetA small colored indicator light.
- property active: bool
- class iskg.widgets._display.LEDDisplay(parent: Widget | None = None, value: Any = 0, digits: int = 4, color: str = 'green', label: str = '', height: int = 32, **kwargs: Any)[source]
Bases:
WidgetA seven-segment LED-style digital display.
- property value: Any
- class iskg.widgets._display.Label(parent: Widget | None = None, text: str = '', wraplength: int | None = None, anchor: str = '', justify: str = '', **kwargs: Any)[source]
Bases:
WidgetA static text label.
- property anchor: str
- property justify: str
- property text: str
- property wraplength: int | None
- class iskg.widgets._display.ProgressBar(parent: Widget | None = None, value: float = 0, max_: int = 100, **kwargs: Any)[source]
Bases:
WidgetA clickable progress bar widget.
Supports click-to-set-value,
commandcallbacks,bind("change", cb), and variable binding. Usemax_to set the range maximum.Usage:
pb = ProgressBar(value=50, max_=100, command=lambda: print("clicked"))
- property value: float
Widget Containers
- class iskg.widgets._containers.Frame(parent: Widget | None = None, text: str = '', **kwargs: Any)[source]
Bases:
WidgetA rectangular container widget for grouping children.
- grid_columnconfigure(column: int, weight: float = 0, minsize: int = 0) None[source]
Configure a grid column’s weight and minimum size.
- Parameters:
column – column index (0-based).
weight – relative weight for distributing extra space (0 = auto).
minsize – minimum column width in pixels (0 = none).
When both weight and minsize are 0 the column is removed from the explicit config and treated as
auto.
- class iskg.widgets._containers.Notebook(parent: Widget | None = None, **kwargs: Any)[source]
Bases:
WidgetA tabbed container widget.
- class iskg.widgets._containers.PanedWindow(parent: Widget | None = None, orient: str = 'horizontal', sash_pos: float = 0.5, minsize: int = 30, **kwargs: Any)[source]
Bases:
WidgetA container with two resizable panes separated by a draggable divider.
- Parameters:
parent – parent widget.
orient –
"horizontal"(left/right panes) or"vertical"(top/bottom).sash_pos – initial divider position as fraction (0.0–1.0, default 0.5).
minsize – minimum pane size in pixels (default 30).
- class iskg.widgets._containers.ScrollBar(parent: Widget | None = None, orient: str = 'vertical', value: float = 0, **kwargs: Any)[source]
Bases:
WidgetA scrollbar widget for scrolling content.
- class iskg.widgets._containers.ScrolledFrame(parent: Widget | None = None, width: int | None = None, height: int | None = None, scroll: str = 'vertical', autoscroll: bool = False, **kwargs: Any)[source]
Bases:
FrameA frame with scrollbars when content overflows.
- Parameters:
parent – parent widget.
width – viewport width in pixels (auto if omitted).
height – viewport height in pixels (auto if omitted).
scroll –
"vertical"(default),"horizontal", or"both".autoscroll – if True, auto-scrolls to bottom on content change (useful for log viewers).
Widget Text
Widget Data
- class iskg.widgets._data.DataGrid(parent: Widget | None = None, columns: list[str] | None = None, rows: list[list[str]] | None = None, width: int = 300, height: int = 200, **kwargs: Any)[source]
Bases:
WidgetA sortable data table with columns and rows.
- property rows: list[list[str]]
- class iskg.widgets._data.DropTarget(parent: Widget | None = None, text: str = 'Drop files here', width: int = 200, height: int = 100, **kwargs: Any)[source]
Bases:
WidgetA drag-and-drop target area.
Widget Canvas
Widget Dialogs
- class iskg.widgets._dialogs.FileDialog[source]
Bases:
objectStatic methods for native file open/save dialogs.
- class iskg.widgets._dialogs.MessageDialog(parent: Widget | None = None, title: str = '', text: str = '', buttons: list[str] | None = None, callback: Callable[[str], None] | None = None, **kwargs: Any)[source]
Bases:
WidgetA message box overlay (info/warning/error/question).
Shows an HTML overlay within the app window. Pass
callbackto receive the clicked button label.
- iskg.widgets._dialogs.showerror(title: str = '', text: str = '', parent: Widget | None = None, callback: Callable[[str], None] | None = None) MessageDialog[source]
Show an error message box (HTML overlay).
- iskg.widgets._dialogs.showinfo(title: str = '', text: str = '', parent: Widget | None = None, callback: Callable[[str], None] | None = None) MessageDialog[source]
Show an info message box (HTML overlay).
- iskg.widgets._dialogs.showquestion(title: str = '', text: str = '', parent: Widget | None = None, callback: Callable[[str], None] | None = None) MessageDialog[source]
Show a question dialog with Yes/No buttons (HTML overlay).
- iskg.widgets._dialogs.showwarning(title: str = '', text: str = '', parent: Widget | None = None, callback: Callable[[str], None] | None = None) MessageDialog[source]
Show a warning message box (HTML overlay).
Widget Misc
Template & Bridge
HTML page builder and JS bridge for ISKG widgets.
Theme
Themes
Named theme definitions for ISKG.
Each theme is a dict of CSS custom property overrides applied on top of
the default IFAZ style sheet (iskg.theme.IFAZ_CSS).
Available themes: ifaz, desert, infinity, cyberdusk, light, dracula, nord, gruvbox, monokai, catppuccin.
Usage:
from iskg.themes import THEMES, available_themes, theme_js
# List available themes
available_themes() # -> ["ifaz", "desert", ...]
# Apply theme at runtime
app.set_theme("dracula")
# Or get JS to apply manually
js = theme_js("nord")
app.execute_js(js)
- iskg.themes.resolve_theme(name: str) dict[str, str][source]
Return the theme dict for name, falling back to
"ifaz".
Fonts
Embedded fonts (SIL OFL) as base64 woff2 data.
No external CDN required — all fonts are compiled directly into the
package as base64-encoded @font-face CSS.
Available fonts and their CSS variables:
Usage:
# Font CSS is automatically included in the page. Use CSS variables:
# var(--font-sans), var(--font-mono), var(--font-rounded), etc.
# Or fall back to system fonts by not setting a custom font:
widget.config(font="bold 14px var(--font-display)")
To use system fonts instead, override the CSS variable:
app._eval_js("document.documentElement.style.setProperty('--font-sans', 'Arial, sans-serif')")