Tutorial: Hello, World

Build and run your first ScriptWeaver app in about a minute.

Your first window

ScriptWeaver gives you a main window for free — it's the global app. Drop a button into it:

const btn = app.TButton({
  text: 'Hello, World!',
  onClick: () => sw.dialog.alert('You clicked it!'),
});
btn.pack.configure({ padx: 40, pady: 40 });

Save that as hello.js and run it:

scriptweaver hello.js

A window opens with a single button; clicking it pops up a native dialog. That's a complete, native, cross-platform app — no HTML, no browser engine.

Adding some state

Most apps remember something. Here's a click counter — a label that updates on every press:

let count = 0;

const label = app.TLabel({ text: 'Clicks: 0' });
label.pack.configure({ padx: 40, pady: 8 });

const btn = app.TButton({
  text: 'Click me',
  onClick: () => {
    count += 1;
    label.text = `Clicks: ${count}`; // an option is also a live property
  },
});
btn.pack.configure({ pady: 8 });

app.wm.title('Counter');

Run it the same way. Each click bumps the counter and the label updates instantly.

What just happened

Next steps