注意: GTK+ 3.x版本跟Python2.7不兼容,如果在Python下使用GTK,需要安装2.x版的gtk+ (在windows上如此)
对windows的64位系统下载这个2.22.1
Parent Directory -
gtk+-bundle_2.22.0-20101016_win64.zip 2010-10-16 19:03 24M
gtk+-bundle_2.22.1-20101229_win64.zip 2010-12-29 15:13 25M
gtk+-dev_2.22.0-1_win64.zip 2010-10-01 23:11 4.2M
gtk+-dev_2.22.1-1_win64.zip 2010-12-29 14:37 4.2M
gtk+_2.22.0-1_win64.zip 2010-10-01 23:15 8.7M
gtk+_2.22.1-1_win64.zip 2010-12-29 14:42 8.7M
32位系统下载:2.24.10
gtk+-bundle_2.24.8-20111122_win32.zip 2011-11-23 22:15 24M
gtk+-bundle_2.24.10-20120208_win32.zip 2012-02-08 22:24 24M
gtk+-dev_2.24.0-1_win32.zip 2011-02-19 14:00 4.1M
gtk+-dev_2.24.8-1_win32.zip 2011-11-23 22:16 4.1M
gtk+-dev_2.24.10-1_win32.zip 2012-02-08 22:26 4.0M
gtk+_2.24.0-1_win32.zip 2011-02-19 14:04 8.3M
gtk+_2.24.8-1_win32.zip 2011-11-23 22:17 8.3M
gtk+_2.24.10-1_win32.zip 2012-02-08 22:32 8.3M
http://www.gtk.org/download/win32_tutorial.php
['', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27\\Lib\\site-packages\\pythonwin', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages', 'C:\\Python27\\lib\\site-packages\\PIL', 'C:\\Python27\\lib\\site-packages\\gtk-2.0', 'C:\\Python27\\lib\\site-packages\\win32', 'C:\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\Python27\\lib\\site-packages\\vlfd']
>>>
Installation and usage tutorial for Windows
Releasing your program
You should always ship all needed DLLs & files with your binaries. End-users should not be required to download the bundle themselves.
Requirements
GTK+3 is known to work on Windows XP, Vista, 7 and 8 at this date.
基本上windows xp以后的操作系统都能用
Developers might want to have a working MinGW or MSVC installation.
取决于MinGW还是native的Visual studio
下载
![]() | gtk+-bundle_3.4.2-20130921_win32.zip | 21-Sep-2013 17:08 | 29M | |
![]() | gtk+-bundle_3.4.2-20131201_win64.zip | 01-Dec-2013 09:30 | 30M | |
![]() | gtk+-bundle_3.6.4-20130921_win32.zip | 21-Sep-2013 17:08 | 29M | |
![]() | gtk+-bundle_3.6.4-20131201_win64.zip | 01-Dec-2013 13:16 | 31M | |
![]() | gtk+-bundle_3.8.2-20131001_win32.zip | 01-Oct-2013 12:42 | 29M | |
![]() | gtk+-bundle_3.8.2-20131201_win64.zip | 01-Dec-2013 16:14 | 31M | |
![]() | gtk+-bundle_3.10.4-20131202_win32.zip | 02-Dec-2013 07:06 | 27M | |
![]() | gtk+-bundle_3.10.4-20131202_win64.zip |
Initial setup
-
Download the latest all-in-one bundle and extract it using right-click -> "Extract All...". Choose a location at your will ; we will call it %GTKDIR% during next phases. 下载all-in-one bundle,只须解压缩到工作文件夹即可
-
Add %GTKDIR%\bin to your PATH environment variable : 须添加环境变量
- Windows XP : right-click on "My Computer" -> "Properties".
- Windows Vista/7 : right-click on "Computer" -> "Properties" -> "Advanced system settings".
Click on "Advanced tab" -> "Environment variables". Double-click on PATH line in "System variables" panel, and add ;%GTKDIR%\bin at the end of the text.
-
Optionally, open a console (Start -> Run -> "cmd" or Start -> search for "cmd") and type the following commands :
- pango-querymodules > %GTKDIR%\etc\pango\pango.modules
- gdk-pixbuf-query-loaders > %GTKDIR%\lib\gdk-pixbuf-2.0\2.10.0\loaders.cache
- gtk-query-immodules-3.0 > %GTKDIR%\lib\gtk-3.0\3.0.0\immodules.cache
-
Let's test ! Still in a console or in the "Run" window, run the demo : gtk3-demo 验证安装
Developing with GTK+3
MinGW 在windows下使用gcc编译器:
You should have a working installation, i.e. "gcc.exe" already in your PATH.
-
In the console, verify that "pkg-config" prints out something reasonable by typing :
pkg-config --cflags --libs gtk+-3.0
-
Use this output in your further compilation commands, like this one :
gcc -o gtk3.exe gtk3.c -mms-bitfields -Ic:/gtk3/include/gtk-3.0 -Ic:/gtk3/include/atk-1.0 -Ic:/gtk3/include/cairo [...]
-
Test the resulting executable (here gtk3.exe) :
MSVC 使用visual studio的情况下:
-
Open the Visual Studio Command Prompt :
-
In the console, verify that "pkg-config" prints out something reasonable by typing :
pkg-config --cflags gtk+-3.0
-
Use this output in your further compilation commands, like this one, modifying the following :
- delete the "-mms-bitfields" switch ;
- add the "-Dinline= /link /libpath:%GTKDIR% gtk-win32-3.0.lib gobject-2.0.lib" switches at the end.
cl gtk3.c -mms-bitfields -Ic:/gtk3/include/gtk-3.0 -Ic:/gtk3/include/atk-1.0 [...] -Dinline= /link /libpath:c:/gtk3/lib gtk-win32-3.0.lib gobject-2.0.lib
("gtk-win32-3.0.lib gobject-2.0.lib" are a minimal requirement. You may want to add other .lib files as you need them)
-
Test the resulting executable (here gtk3.exe) :