{"id":48965298,"url":"https://github.com/sigmasd/js-gtk-py","last_synced_at":"2026-04-18T04:02:50.427Z","repository":{"id":206557536,"uuid":"716758400","full_name":"sigmaSd/js-gtk-py","owner":"sigmaSd","description":"Wrapper + types over Gtk using javascript python bindings","archived":false,"fork":false,"pushed_at":"2025-12-25T08:42:39.000Z","size":217,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-26T21:45:42.591Z","etag":null,"topics":["adwaita","deno","gtk","python"],"latest_commit_sha":null,"homepage":"https://jsr.io/@sigma/gtk-py","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sigmaSd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-11-09T20:12:01.000Z","updated_at":"2025-12-25T08:42:43.000Z","dependencies_parsed_at":"2023-12-05T19:24:59.059Z","dependency_job_id":"76359474-7803-47b2-b7f8-29bba173fe7c","html_url":"https://github.com/sigmaSd/js-gtk-py","commit_stats":null,"previous_names":["sigmasd/deno-gtk-py"],"tags_count":69,"template":false,"template_full_name":null,"purl":"pkg:github/sigmaSd/js-gtk-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigmaSd%2Fjs-gtk-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigmaSd%2Fjs-gtk-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigmaSd%2Fjs-gtk-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigmaSd%2Fjs-gtk-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sigmaSd","download_url":"https://codeload.github.com/sigmaSd/js-gtk-py/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigmaSd%2Fjs-gtk-py/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31955920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adwaita","deno","gtk","python"],"created_at":"2026-04-18T04:02:46.832Z","updated_at":"2026-04-18T04:02:50.423Z","avatar_url":"https://github.com/sigmaSd.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JS Gtk Py\n\nWrapper + types over Gtk using javascript python bindings\n\n## Usage\n\n```ts\n#!/usr/bin/env -S JS -A\nimport {\n  type Adw1_ as Adw_,\n  type GLib2_ as GLib_,\n  type Gtk4_ as Gtk_,\n  JSGLibEventLoop,\n  kw,\n  NamedArgument,\n  python,\n} from \"jsr:@sigma/gtk-py\";\n\nconst gi = python.import(\"gi\");\ngi.require_version(\"Gtk\", \"4.0\");\ngi.require_version(\"Adw\", \"1\");\nconst Gtk: Gtk_.Gtk = python.import(\"gi.repository.Gtk\");\nconst Adw: Adw_.Adw = python.import(\"gi.repository.Adw\");\nconst GLib: GLib_.GLib = python.import(\"gi.repository.GLib\");\n// Use JSGLibEventLoop to keep JS's event loop running\n// This allows setTimeout, fetch, and other JS APIs to work normally\nconst eventLoop = new JSGLibEventLoop(GLib);\n\nclass MainWindow extends Gtk.ApplicationWindow {\n  #button;\n  constructor(kwArg: NamedArgument) {\n    super(kwArg);\n    this.set_title(\"Demo\");\n    this.connect(\"close-request\", () =\u003e {\n      eventLoop.stop();\n    });\n    this.#button = Gtk.Button(kw`label=${\"Click Me\"}`);\n    this.#button.connect(\n      \"clicked\",\n      python.callback(() =\u003e {\n        const dialog = Adw.MessageDialog(\n          new NamedArgument(\"transient_for\", this),\n          new NamedArgument(\"heading\", \"JS GTK PY\"),\n          new NamedArgument(\"body\", \"Hello World\"),\n        );\n        dialog.present();\n        setTimeout(() =\u003e {\n          dialog.close();\n        }, 1000);\n      }),\n    );\n    this.set_child(this.#button);\n  }\n}\n\nclass App extends Adw.Application {\n  #win: MainWindow | undefined;\n  constructor(kwArg: NamedArgument) {\n    super(kwArg);\n    this.connect(\"activate\", this.onActivate);\n  }\n  onActivate = python.callback((_kwarg, app: Gtk_.Application) =\u003e {\n    this.#win = new MainWindow(new NamedArgument(\"application\", app));\n    this.#win.present();\n  });\n}\n\nconst app = new App(kw`application_id=${\"com.example.com\"}`);\n\nawait eventLoop.start(app);\n```\n\nCheck out the examples directory\n\n![image](https://github.com/sigmaSd/0.6.3/22427111/cd8a4a23-4ef2-4185-b57a-94de1494cbdb)\n\n## Tips\n\n- The `JSGLibEventLoop` is the recommended way to run GTK apps. It integrates\n  GLib's event loop with Javascript, allowing `setTimeout`, `fetch`, and other\n  APIs to work normally alongside your GTK UI.\n- **Alternative**: Use `app.run()` for the traditional blocking GTK event loop.\n  Note that javascript APIs like `setTimeout` won't work in this mode. You'll\n  need to use GLib primitives like `GLib.timeout_add` instead.\n- For running async subprocesses, check out `Gio.Subprocess`\n\n## Random apps made with it\n\n- https://github.com/sigmaSd/Stimulator\n- https://github.com/sigmaSd/chrono\n\n## References\n\n- python gtk4 docs: http://lazka.github.io/pgi-docs/\n- gtk4 docs: https://docs.gtk.org/gtk4/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigmasd%2Fjs-gtk-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsigmasd%2Fjs-gtk-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigmasd%2Fjs-gtk-py/lists"}