简体   繁体   中英

pygtk.glade 'no module named glade' on python 2.7

I am using Python 2.7 on windows I want to install a software called febrl on python which requires pygtk.glade I have installed all the modules that were specified in the software manual, especially PYGTK all-in-one but i get an error when i try to import pygtk.glade (i have no error when i do : import pygtk)

import pygtk.glade
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named glade

Is there a way to install glade for python on windows? Thank you

Gtk.Builder and friends are already in the Gtk module included. So, if you

from gi.repository import Gtk

you have access to the builder. You do not need Glade inside your python code. Glade is an external tool (separate from Python) which generates an XML file (normally called yourproject.ui, yourproject.glade or so), which is the description of the GUI you designed.

In your code you then have to make an instance of GtkBuilder, and read the XML file. This will generate all the widgets and make them available in your program.

Have a look at this tutorial .

That same XML is also usable in many other languages using a similar process - call GtkBuilder, etc.

maybe you need to do from pygtk import glade

check this for more information: http://www.pygtk.org/articles/pygtk-glade-gui/Creating_a_GUI_using_PyGTK_and_Glade.htm

在下面运行此命令,它可以解决所有缺少的依赖项:

apt-get install python python-gtk2 python-glade2 libgtk2.0-dev libsqlite3-0

By running pip search glade I get this

BabelGladeExtractor (0.2dev-r288) - Babel Glade XML files translatable strings extractor

BD (0.0.5) - Bangladesh Details with postal code

GladeBuilder (0.1.0) - Easy way to get and set values/properties of Gtk2/Gtk3 widgets.

SPE (0.8.3.c) - Python IDE with Blender, Kiki, PyChecker, Remote debugger, Uml and wxGlade support

I am pretty sure doing either

pip install GladeBuilder

of

pip install SPE

will solve it. But then again you are on windows so it really depends.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM