{"id":30885758,"url":"https://github.com/tahairavani/learn-gtk4-with-python","last_synced_at":"2025-09-08T12:08:26.281Z","repository":{"id":309039305,"uuid":"1034960739","full_name":"tahairavani/learn-gtk4-with-python","owner":"tahairavani","description":"A guide for those who are just starting out learning Gtk for python applications.","archived":false,"fork":false,"pushed_at":"2025-08-09T12:37:54.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-09T13:21:12.661Z","etag":null,"topics":["gtk","gtk4","gui","python","python3","tutorial"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tahairavani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-08-09T10:59:49.000Z","updated_at":"2025-08-09T12:37:56.000Z","dependencies_parsed_at":"2025-08-09T13:21:14.840Z","dependency_job_id":"6bf47ae1-d969-4b0a-a837-6faabc38f4cf","html_url":"https://github.com/tahairavani/learn-gtk4-with-python","commit_stats":null,"previous_names":["tahairavani/learn-gtk4-with-python"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/tahairavani/learn-gtk4-with-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tahairavani%2Flearn-gtk4-with-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tahairavani%2Flearn-gtk4-with-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tahairavani%2Flearn-gtk4-with-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tahairavani%2Flearn-gtk4-with-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tahairavani","download_url":"https://codeload.github.com/tahairavani/learn-gtk4-with-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tahairavani%2Flearn-gtk4-with-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274181741,"owners_count":25236552,"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","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"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":["gtk","gtk4","gui","python","python3","tutorial"],"created_at":"2025-09-08T12:08:24.379Z","updated_at":"2025-09-08T12:08:26.273Z","avatar_url":"https://github.com/tahairavani.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# how to learn Gtk4 with python ? \nhi 👋 To my programmer friends! today let's learn Gtk4 with python for create any application📱 \nI'm just learning GTK myself, so I'm trying to share anything new I learn about it here.\n\n\nIf you liked it and I was able to help you on your way to learning GTK, I would be happy if you would star the project ⭐\n\n## install Gtk4 for python \n\nyou can install Gtk4 for python with pip\n\nfirst install pycairo with this command :\n\n\n~~~shell\npip install pycairo\n~~~\n\n\nand next install gtk for python with this command : \n\n~~~shell\npip install PyGObject\n~~~\nCongratulations, you have successfully installed GTK on your Python. 😍\n\n## use Gtk4 in python \nfor use gtk version 4 in python and create your helpful application import gtk from gi and utilize this mudle in your apps\n### 1. import Gtk\nfor import gtk you can type this code's \n~~~python\nimport gi\n#setup to version 4.0\ngi.require_version('Gtk','4.0')\n#import Gtk \nfrom gi.repository import Gtk\n~~~\n\n### 2. create your first gui app with gtk\ncreate your window with Gtk.ApplicationWindow() object\n\n~~~python\ndef on_open_application(app):\n    window = Gtk.ApplicationWindow(application = app) # create window\n    window.present() # show window\n~~~\n\n### 3. create your application and connect to your window and in last step run it !\n~~~python\napp = Gtk.Application() # create application\napp.connect(\"activate\",on_open_application) # connect your application to window\n\napp.run(None) #start your application\n~~~\n### 4. run your program with python\nyou succsessful develop your first application \ncompileted code : \n~~~python\nimport gi\n#setup to version 4.0\ngi.require_version('Gtk','4.0')\n#import Gtk \nfrom gi.repository import Gtk\n\ndef on_open_application(app):\n    window = Gtk.ApplicationWindow(application = app) # create window\n    window.present() # show window\n\napp = Gtk.Application() # create application\napp.connect(\"activate\",on_open_application) # connect your application to window\n\napp.run(None) #start your application\n~~~\ni write it code on first_app.py in this repository\n\n~~~shell\npython your_app.py \n~~~\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"assets/screenshot/first-app-screenshot.png\"\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftahairavani%2Flearn-gtk4-with-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftahairavani%2Flearn-gtk4-with-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftahairavani%2Flearn-gtk4-with-python/lists"}