{"id":16839517,"url":"https://github.com/sigmasd/deno-gtk-py","last_synced_at":"2025-03-18T04:25:39.915Z","repository":{"id":206557536,"uuid":"716758400","full_name":"sigmaSd/deno-gtk-py","owner":"sigmaSd","description":"Deno wrapper+types over gtk using deno-python","archived":false,"fork":false,"pushed_at":"2025-02-17T16:41:11.000Z","size":153,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T17:38:25.706Z","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}},"created_at":"2023-11-09T20:12:01.000Z","updated_at":"2025-02-17T16:41:15.000Z","dependencies_parsed_at":"2023-12-05T19:24:59.059Z","dependency_job_id":"76359474-7803-47b2-b7f8-29bba173fe7c","html_url":"https://github.com/sigmaSd/deno-gtk-py","commit_stats":null,"previous_names":["sigmasd/deno-gtk-py"],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigmaSd%2Fdeno-gtk-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigmaSd%2Fdeno-gtk-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigmaSd%2Fdeno-gtk-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigmaSd%2Fdeno-gtk-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sigmaSd","download_url":"https://codeload.github.com/sigmaSd/deno-gtk-py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244155382,"owners_count":20407335,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-10-13T12:32:40.328Z","updated_at":"2025-03-18T04:25:39.894Z","avatar_url":"https://github.com/sigmaSd.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deno Gtk Py\n\nWrapper + types over Gtk using deno-python\n\n## Usage\n\n```ts\n#!/usr/bin/env -S deno run --allow-ffi --allow-env=DENO_PYTHON_PATH --unstable-ffi\nimport {\n  type Adw1_ as Adw_,\n  type Gtk4_ as Gtk_,\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\");\n\nclass MainWindow extends Gtk.ApplicationWindow {\n  #button;\n  constructor(kwArg: NamedArgument) {\n    super(kwArg);\n    this.set_title(\"Demo\");\n    this.#button = Gtk.Button(kw`label=${\"Click Me\"}`);\n    this.#button.connect(\n      \"clicked\",\n      python.callback(() =\u003e {\n        Adw.MessageDialog(\n          //@ts-ignore it is a window\n          new NamedArgument(\"transient_for\", this),\n          new NamedArgument(\"heading\", \"Deno GTK PY\"),\n          new NamedArgument(\n            \"body\",\n            \"Hello World\",\n          ),\n        ).present();\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\"}`);\napp.run(Deno.args);\n```\n\nCheck out the examples directory\n\n![image](https://github.com/sigmaSd/0.4.10/22427111/cd8a4a23-4ef2-4185-b57a-94de1494cbdb)\n\n## Tips\n\n- Gtk have its own loop, somethings that you expect to work might not do to\n  this, for example `setTimeout` wont work in a python.callback after running\n  Gtk.Applicaiton. The solution is to use the primitives that GLib provides, for\n  example instead of `setTimeout`, use `GLib.add_timeout`\n- For running async subprocess checkout `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  - 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%2Fdeno-gtk-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsigmasd%2Fdeno-gtk-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigmasd%2Fdeno-gtk-py/lists"}