{"id":21669386,"url":"https://github.com/dontpanic92/wxgo","last_synced_at":"2025-04-06T13:10:55.938Z","repository":{"id":12239396,"uuid":"14851447","full_name":"dontpanic92/wxGo","owner":"dontpanic92","description":"Golang wxWidgets Wrapper","archived":false,"fork":false,"pushed_at":"2018-11-07T05:58:20.000Z","size":197454,"stargazers_count":403,"open_issues_count":26,"forks_count":50,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-03-30T11:11:14.251Z","etag":null,"topics":["go","gui","wxwidgets"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dontpanic92.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}},"created_at":"2013-12-02T03:03:01.000Z","updated_at":"2024-12-30T07:49:27.000Z","dependencies_parsed_at":"2022-09-26T18:21:27.832Z","dependency_job_id":null,"html_url":"https://github.com/dontpanic92/wxGo","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dontpanic92%2FwxGo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dontpanic92%2FwxGo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dontpanic92%2FwxGo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dontpanic92%2FwxGo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dontpanic92","download_url":"https://codeload.github.com/dontpanic92/wxGo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247485287,"owners_count":20946398,"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":["go","gui","wxwidgets"],"created_at":"2024-11-25T12:21:36.958Z","updated_at":"2025-04-06T13:10:55.916Z","avatar_url":"https://github.com/dontpanic92.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"wxGo\n====\n\nGolang wxWidgets Wrapper\n\n[![Travis CI Build Status](https://travis-ci.org/dontpanic92/wxGo.svg?branch=master)](https://travis-ci.org/dontpanic92/wxGo)\n[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/ywus0amnmy72uaa4/branch/master?svg=true)](https://ci.appveyor.com/project/dontpanic92/wxgo/branch/master)\n\nNot actively maintained\n----\nPlease feel free to folk and make your changes. I'm still available through GitHub Issues for any questions.\n\nNotes\n----\nFor Golang 1.10.0 and 1.9.4, there is a \"Invalid flag\" issue which causes the build fails. Please check [Here](https://github.com/dontpanic92/wxGo/issues/44#issuecomment-368310742) for workaround.\n\nCompilation \n----\n\nCurrently wxGo can compile and run on Windows, Linux and Mac OS X on amd64 architecture.\n\n#### 1. Requisites\n\n- 64-bit Go\n- GCC / MinGW ver \u003e 5 for Linux / Windows\n- \\\u003e 5GB Memory space\n\n__Remarks__\n\n32-bit go will [run out of memory](https://github.com/dontpanic92/wxGo/issues/3) due to ~5GB memory consumption when compiling and I have no idea on how to decline the memory usage. Any suggestion or discussion will help.\n\nThe precompiled wxWidgets is compiled with gcc \u003e 5 ( 6.2.1 on Linux, 5.3.0 on Windows using tdm-gcc). So if you want to use the precompiled wxWidgets, your gcc version has also to be \u003e 5, because [GCC changed its ABI since GCC 5 release series](https://gcc.gnu.org/gcc-5/changes.html#libstdcxx).\n\n\n#### 2. Build \u0026 Install\n\n```\ngo get github.com/dontpanic92/wxGo/wx\n```\n\nYou can add `-x` option to print each command it executes.\n\nCustom Compilation\n----\n\nThis section will introduce how to customize wxGo.\n\n#### 1. Compilation phases\n\nwxGo needs a 2-phase compilation. The first is the SWIG phase, that is using [SWIG](https://github.com/SWIG/SWIG) to generate the wrapper code. And the second is the Go phase, which has been described above.\n\n\n#### 2. Customize SWIG phase\n\nYou can regenerate the wrapper code using SWIG. Compilation dependencies are:\n\n- python 2 or 3\n- sed\n- make\n- A customized SWIG\n\n\nWe use a customized SWIG to generate the wrapper code. Please clone https://github.com/dontpanic92/SWIG and simply `./configure \u0026\u0026 make \u0026\u0026 sudo make install`. Then you can modify the source as you want, and run `make` in the `build` folder.\n\n#### 3. Customize wxWidgets build\n\nIf you want to use other wxWidgets build rather than the precompiled one, what you have to do is quite simple.\n\n- Compile wxWidgets\n- Run `go get -d github.com/dontpanic92/wxGo/wx` to let the go-tool just download the source\n- Open `wx/setup_OS_ARCH.go`, change the `CPPFLAGS` and `LDFLAGS`\n- Run `go install github.com/dontpanic92/wxGo/wx`\n\nDone!\n\nUsage\n----\n\nAfter importing `github.com/dontpanic92/wxGo/wx`, the following code will create an empty dialog with a \"Hello World\" as its caption.\n\n```go\n    wx.NewApp()\n    f := wx.NewDialog(wx.NullWindow, -1, \"Hello World\")\n    f.ShowModal()\n    f.Destroy()\n```\n\nAll the wx-Classes' objects can be created using `wx.NewCLASS`. Now let us add some controls on it :\n\n```go\n    wx.NewApp()\n    f := wx.NewDialog(wx.NullWindow, -1, \"Hello World\")\n\n    bSizer := wx.NewBoxSizer(wx.VERTICAL)\n\n    checkBox := wx.NewCheckBox(f, wx.ID_ANY, \"Check Me!\", wx.DefaultPosition, wx.DefaultSize, 0)\n    bSizer.Add(checkBox, 0, wx.ALL|wx.EXPAND, 5)\n\n    textCtrl := wx.NewTextCtrl(f, wx.ID_ANY, \"\", wx.DefaultPosition, wx.DefaultSize, 0)\n    bSizer.Add(textCtrl, 0, wx.ALL|wx.EXPAND, 5)\n\n    f.SetSizer(bSizer)\n    f.Layout()\n    f.ShowModal()\n    f.Destroy()\n```\n\nAnd then we can bind an event on the checkbox :\n\n```go\nfunc checkboxClicked(e wx.Event) {\n    wx.MessageBox(\"Checkbox clicked!\")\n}\n\n//....\n    wx.Bind(f, wx.EVT_CHECKBOX, checkboxClicked, checkBox.GetId())\n//....\n```\n\nBravo!\n\n__Remarks : about the memory management__\n\nAll `wx.NewCLASS` functions will allocate memory on C++ side (on heap), thus it will not be tracked by Go's garbage collector. However, in most cases we don't need to worry about it, because wxWidgets will handle it. Some common cases are listed below:\n\n- √ When a `wxWindow` (or its subclasses) being deleted , it will automatically delete all of its children.\n\n- √ When we click the close button of a `wxFrame`, by default the `Destroy` will be called and it will be deleted by itself (and also all children). \n\n- × However when we close a `wxDialog`, the `Destroy` won't be called by default and we have to manually destroy it.\n\n- × If an object isn't in the GUI hierarchy, we have to free the memory by calling `DeleteCLASS`. \n\nIn a word, `p := wx.NewCLASS` in Go acts the same as `p = new wxCLASS()` in C++. Where we need a `delete p`, then we need a `wx.DeleteCLASS`.\n\nMore Info: \n\n- [wxWidgets docs on window deletion](http://docs.wxwidgets.org/3.0/overview_windowdeletion.html)\n\n- [SWIG docs on Go memory management](http://www.swig.org/Doc3.0/Go.html#Go_class_memory)\n\nExamples\n----\n\nExamples are in the `examples` folder. `Dapeton` is a simple notepad, and `controls` is a dialog that contains several widgets.\n\nScreenShot\n----\n\n![screenshot](./examples/screenshot.jpg)\n\nLicense\n----\n\nwxGo is licensed under the [wxWindows Library Licence](http://wxwidgets.org/about/licence/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdontpanic92%2Fwxgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdontpanic92%2Fwxgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdontpanic92%2Fwxgo/lists"}