PyGObject-Tutorial
PyGObject-Tutorial copied to clipboard
Please elaborate docs for ms-windows users
Please elaborate the docs, and tell us how to install if you use ms-windows:
https://python-gtk-3-tutorial.readthedocs.io/en/latest/install.html
Thank you very much.
Options being:
- http://www.msys2.org/
- https://github.com/wingtk/gvsbuild/
@TingPing You mentioned two tools. Both seem to do some C/C++ compiling. I ask myself if this is needed. Is there no way to do python+gtk development without compiling?
On linux I don't need to do compiling to do develop a simple tool with python and gtk.
Is there no way to just download the binary gtk-libray?
msys2 doesn't require compiling anything, but if you want to use msvc python (upstream python) then sadly yes you have to build it for now. They want to get binary releases out there but it just hasn't happened yet.
I have notopinion (msys2 vs upstream python) up to now. I would like to follow the sane default way which is done by most other developers. Is this msys2? I love it, if maintainers say "If unsure do x".
The number of pygobject applications shipping installers on Windows is probably quite small, I don't think there is a "default" way.
The gvsbuild way is much more work but means you get to use python.org's installer. I like that.
The msys2 way is easier.
Pick your poison I guess.
I am unsure if I understood that correctly. You said:
The number of pygobject applications shipping installers on Windows is probably quite small
My goal is to write a simple gtk based programm which does get installed via an msi file. With cx_freeze I am able to create a msi file with bdist_msi.
This means I don't want the user to install Python first. The msi should contain all that is needed.
I would like to take the easy way. What is simpler?
python2 vs python3?
gtk2, pygobject ...?
I have no clue.
pygtk
(gtk2) is extremely dead and Python 2 only has a bit more than a year of support left.
I also wished the docs were a little more specific/complete for Windows users. What I've learned so far (please correct any mistakes, this should be seen as a first rough draft as I don't have much experience in this area):
-
The MSYS2 way
- You don't have to compile anything
- You have to use MSYS2's own packaged version of Python for development, which is different from any Python you may have installed natively on Windows
- You have to use MSYS2's own packaged version of PyGObject and dependencies
- To distribute your program, besides MSYS2's PyGObject libraries, you have to package parts of MSYS2 with it (?)
-
The gvsbuild way
- You have to compile PyGObject and dependencies, unless you're happy with an old version still available on SourceForce
- You can use the native Windows Python installation for development
- To distribute your program, you can ship it with the native PyGObject libraries (no additional libs required) (?)
-
The pip way (pip install PyGObject)
- Basically the same as gvsbuild, but managed by
pip
which will (try) to do the fetching of sources & building for you. This failed for me (cairo.h was missing, didn't try too hard to work around it)
- Basically the same as gvsbuild, but managed by
Just for the records, I switched to PySide. After the switch the task got completed very soon. And now I am happy that I don't need to do any native GUI stuff any more. Related: https://github.com/guettli/programming-guidelines/blob/master/README.rst#avoid-writing-a-native-gui
But I leave this issue open, since other people seem to have the same issue.