Pygtk all in one windows

Pygtk all in one windows

Using the PyGTK All-in-one installer

The PyGTK All-in-one version number

The PyGTK All-in-one installers’ version number does not map directly to the PyGTK version number, simply because the PyGTK All-in-one installer is a repackaging of multiple components where each component may receive updates in the form of a new PyGTK All-in-one installer revision release. It is also a requirement to support windows installer major upgrades. The version number is constructed as follows:

What file should I use?

All the .msi files are named as follows:

Where X.X.X is the PyGTK All-in-one version number, YY is 32 or 64 and Z.Z is the Python version number the installer supports. Currently, only 32 bit Python is supported (on both 32 and 64 bit Windows).

You need to make sure both YY and Z.Z correspond to the version of the Python interpreter that’s installed on your system.

I’m new, how do I start?

First, you’ll need to install a 32 bit Python interpreter. Currently, you can choose between Python 2.6 and Python 2.7.

Then you install the PyGTK All-in-one version that matches the Python version you choose above. It’s that easy!

Migrating from PyGTK+PyGObject+PyCairo packages

If you have used some or all of the separate PyGTK, PyGObject, PyGooCanvas, PyGtkSourceView2, PyRsvg and PyCairo packages before, please ensure they are uninstalled before you begin with the PyGTK All-in-one installer.

The all-in-one installer does not check for their presence and will happily overwrite files that belong to the separate packages. If you forget to check for this you risk the following scenario:

  • install Python
  • install PyCairo, PyGTK and PyGObject
  • install PyGTK All-in-one
  • uninstall PyCairo, PyGTK and PyGObject
  • you now have a broken pygtk all-in-one installation

This would also be a good time to remove the GTK+ runtime you’ve used with the separate PyG* packages and to clean your PATH environment variable.

Note that the PyCaio, PyGObject, PyGTK, PyGoocanvas, PyGtkSourceView2 and PyRsvg .exe installers (like any other .exe installer generated by distutils) sometimes leave things behind when you uninstall them.

A default PyGTK All-in-one installation automatically detects the correct Python installation directory and if Python was installed for all users or just yourself. These values are then used by the PyGTK All-in-one installer. To start a default PyGTK All-in-one installation, simply double click the .msi file or execute the following command from a Command Prompt (cmd.exe):

Like any other Windows Installer package, you can change how PyGTK All-in-one will be installed on you system by passing parameters (setting public properties for those familiar with windows installer). Execute %WINDIR%system32msiexec /help for a list of options supported for all .msi installation packages.

The TARGETDIR property determines the root directory of the PyGTK All-in-one installation. If this property is set, the PyGTK All-in-one installer does not automatically detect the installation directory of the Python interpreter installed on you system. For example, a custom installation directory can be specified with:

Читайте также:  Windows 10 до которого числа

Before you set a custom TARGETDIR property, you need to make sure both python.exe and pythonw.exe exist in that directory or the installation will fail.

Installation for All Users

The ALLUSERS property determines if PyGTK All-in-one should be installed for all users, or only for the user that initiated the installation. If you want to install for all users, set the ALLUSERS property to «1»:

If you want to install for the current user only, you should not specify the ALLUSERS property at all. Hence, a per user installation is the default installation mode for custom installations. Note that «1» is the only valid value for the ALLUSERS property!

You need to combine this property with the TARGETDIR property. Setting ALLUSERS disables the automatic Python interpreter detection.

The INSTALLLEVEL property determines what features are going to be installed. If the INSTALLLEVEL property is not set, its value defaults to 1 which causes a basic set of features to be installed (GTK+ runtime, PyGTK, PyGObject and PyCairo)

If you set INSTALLLEVEL to 2 (or any number greater than 2), you instruct the installer to do a «complete» installation (all features will be installed).

There is another method to control what features should be installed by controlling the ADDLOCAL, REMOVE, ADDDEFAULT, REINSTALL, etc properties. Check MSDN for more details.

Other msiexec options

Take note that if the PyGTK All-in-one installer is run with no or a basic UI (/q[n|b]) the automatic Python installation detection is skipped. In this case setting the TARGETDIR property is required. You can also set the ALLUSERS property if you want a system wide installation.

The PATH environment variable

The PyGTK All-in-one installer does not require you to fiddle with the PATH environment variable. The PyGTK version that’s installed with the all-in-one installer takes care of loading the bundled GTK+ runtime on the PATH environment variable on interpreter startup. As a consequence simply importing gobject, gtk, etc works out of the box. And as an added advantage there is no possible way multiple GTK+ runtime versions on your system or user PATH environment variable can interfere with PyGTK All-in-one.

If something doesn’t work as expected, you’ll need to generate a couple of log files before you’ll be able to get help. It is simply impossible to determine why something went wrong without these log files.

If something went wrong when installing, you’ll need both:

An installation log (install.log). Execute the following command from a Command Prompt (cmd.exe):

An execution log (import.log). Execute the following command from a Command Prompt (cmd.exe):

If something went wrong when uninstalling, you’ll need an unistall log. Execute the following command from a Command Prompt (cmd.exe):

Please consider compressing the log files you obtained before you send them by mail or attach them to a bug report. Those files can be quite large. If you do not have a compression program yet, 7-Zip from http://www.7-zip.org/ is a good choice.

In theory, Windows 2000 should be supported, but in practice the gtk+ binaries on ftp.gnome.org are affected by libgio-2.0-0.dll needing the freeaddrinfo() function which is only available starting from Windows XP:

Читайте также:  Windows журнал событий cmd

When/if the above get’s fixed, you would still need to install gdiplus.dll:

  • Download the GDI+ Platform SDK redistributable from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6a63ab9c-df12-4d41-933c-be590feaa05a&displaylang=en
  • Execute the downloaded WindowsXP-KB975337-x86-ENU.exe and it will ask to extract some files.
  • Copy the extracted asms\10\msft\windows\gdiplus\gdiplus.dll file to C:\Python2X\Lib\site-packages\gtk-2.0\runtime\bin

About the pygtk-installer project

The pygtk-installer project provides a set of tools to build the PyGTK All-in-one installer and its various dependencies. There are currently versions of the PyGTK All-in-one installer supporting 32 bit versions of Python 2.6 and Python 2.7.

  • build_bindings.sh: a tool that builds windows installer packages (both .exe and .msi) for pycairo, pygobject, pygtk, pygoocanvas, pygtksourceview and pyrsvg for each supported Python version.
  • build_installer.py: a tool that generates the all-in-one installer bundling the separate .msi installers created by build_bindings.sh and various GTK+ runtime packages from ftp.gnome.org/pub/GNOME/binaries/win32/.

For more information on using these tools, refer to the doc/HACKING.rst file.

About

PyGTK All-in-one installer, stable releases are on:

python pygtk windows 7 64 bit

I have been working with pygtk on linux for some time.I just want to make my app more distributable. Now I have used pygtk for 32 bit, but now I’d like to use pygtk for 64bit using pygtk 64bit. I have downloaded the all in one installer. I have changed my path as gtk would want and run the «pkg-config —cflags gtk+-2.0» command then ran the gtk-demo command and it did give me a demo and that works perfectly! Just I am missing someting because there in still no module named ‘gtk’ in my python gtk 64 bit.

I want to make the 64 bit version of gtk work on windows and when I get a fix I want to post on Youtube on how to make it work for others.

Thank you, I hope someone can help cause the documentation is lacking on this part.

1 Answer 1

Ok for those that are searching for a GUI Python lib to be used in Windows 64 bit here it is!

1) Install from python.org the python 64bit, If you already have python installed on your system, you wont need to worry about this. http://www.python.org/ftp/python/2.7.3/python-2.7.3.amd64.msi

2)Add to your PATH in the advanced settings/environment variables ;C:\python27

4)create a folder that is in c:\opt\gtk # it doesn’t really matter where you’ll just have to add it to PATH. unzip the folder and copy all the files to the the file created above. then, set your PATH to the file created E.G ;C:\opt\gtk\bin

You can test it now in cmd by typing: «gtk-demo»

5)Now you still have to get the libraries gtk,PyCairo,goobject http://www.lfd.uci.edu/

I hope it helps. I saw a file «py2cairo-1.10.0.win-amd64-py2.7.‌exe» I am not certain if this is needed I am currently testing my applications. Now I just need to find gtksourceview2/3 for win7 64bit. Good Luck! 😉

How do I get a list of all windows on my gnome2 desktop using pygtk?

I’m a bit confused with some gtk and gnome concepts. I’m trying to get list of non minimized windows on my gnome2 desktop, but after reading the pygtk documentation and inspecting the results, I can’t understand the results.

Читайте также:  Драйвер для принтера hp laserjet 1132 mfp для windows 10

Neither of the two snippets below appears to work.

First I tried this..

As seen in the console output, the second option returns two windows. But I haven’t been able to figure out what they are. None of them has any children and I allways get those two windows regardless how many windows I have on my desktop.

Could anybody explain the hierarchy of objects of the typical gtk based desktop environment? I can’t understand why the above code doesn’t work.

Please refrain from posting alternative solutions that resource to wnck, xlib, qt, etc. I’m more interested in understanding what I am doing wrong than in getting advice such us checking other libraries.

2 Answers 2

Your constraint is like saying «I want to build a CD player using only a banana. Please refrain from posting alternative solutions that resort to lasers.» GTK can’t do that, you’re using the wrong tool for the job.

Here’s an explanation of what a «window» actually means and why your code doesn’t work:

First off, you need to understand the difference between a gtk.Window and a gtk.gdk.Window . A GTK window is a top level GTK widget that can contain other widgets. It is usually linked to a window on your desktop, but doesn’t have to be — in GTK 3 there is an OffscreenWindow .

A GDK window, on the other hand, is platform-dependent. On an X desktop it is a thin wrapper around an X window, which is not necessarily a toplevel desktop window. On other systems it exists to abstract away the windowing system. A GDK window receives events, so some GTK non-window widgets have their own GDK windows. «Window» is really a terrible name for these objects, but it was inherited from X and it’s probably not going to change.

Each GTK process only knows about its own windows. You can get a list of the toplevel GTK windows of your own application using gtk.window_list_toplevels() . Getting the children of these windows should return you the GTK widgets that they contain. However, you can’t descend into the widget hierarchy of other processes’ windows. For example, what if another process has a window with a child widget that is a custom widget that your process doesn’t know about? What should it report as the type of that widget?

Getting a list of the toplevel GDK windows with gtk.gdk.window_get_toplevels() is basically the same as getting a list of the toplevel X windows, as far as I understand it. You have no way of knowing what kind of windows they are — they might be the Gnome Panel, or they might be Qt windows, or they might be something else altogether that doesn’t correspond with a desktop window.

Libwnck (link to the overview of what it does) can get you a list of non-minimized windows, and their titles, but it won’t allow you to see inside them. There’s no way to do that. Libwnck uses GDK internally, so technically you could do it using GDK, but why would you bother if there’s already a library that does that for you? If you really want to do it yourself, look at the libwnck source code.

Оцените статью