Re: [pygtk] cannot import gnome
Christian Robottom Reis wrote: On Fri, May 20, 2005 at 01:19:40PM +0200, Martijn Brouwer wrote: I have a Debian Sarge system with python 2.3 and python-gnome-2.6.1. Importing pygtk in the way described by the tutorial does not work: import pygtk pygtk.require(2.0) import gtk import gnome Traceback (most recent call last): File stdin, line 1, in ? ImportError: No module named gnome However, when I do not import pygtk import gnome does work: import gtk import gnome What appears to be happening is that something is very wrong with your site-packages directory. - The default gtk being imported does not appear to be the 2.0 variant - Gnome appears to be installed fine for whatever version is the default - Gnome appears to not be installed for the 2.0 variant you are using (you say python-gnome-2.6.1, but are you sure?) What do your site-packages/gtk* and gnome* contents look like? the gtk and gnome are both installed under /usr/lib/python2.3/site-packages. gnome is installed in the gtk dir. /usr/bin/python is a link to /usr/bin/python2.3. The versions of the libraries are taken from my package management system (apt). Is there a way to find the imported version of some library from the python prompt? Bye, Martijn Brouwer ls /urs/lib/python2.3/site-packages | grep gtk: gtk-1.2 gtk-2.0 pygtk.pth pygtk.py pygtk.py.python-gtk-1.2 pygtk.py.python2.3-gtk2 pygtk.pyc pygtk.pyo wx-2.5.3-gtk2-unicode ls -l /urs/lib/python2.3/site-packages/gtk-2.0 -rw-r--r-- 1 root root 894 Mar 17 17:55 atk.la -rw-r--r-- 1 root root 27664 Mar 17 17:55 atk.so drwxr-xr-x 2 root root 4096 Dec 2 09:53 bonobo -rw-r--r-- 1 root root 11666 Mar 17 17:55 dsextras.py -rw-r--r-- 1 root root 16990 Mar 29 13:07 dsextras.pyc -rw-r--r-- 1 root root 16990 Mar 29 13:07 dsextras.pyo -rw-r--r-- 1 root root 972 Nov 16 2004 gconf.la -rw-r--r-- 1 root root 42256 Nov 16 2004 gconf.so drwxr-xr-x 2 root root 4096 Dec 2 09:53 gnome drwxr-xr-x 2 root root 4096 Dec 2 09:53 gnomeprint -rw-r--r-- 1 root root 900 Mar 17 17:55 gobject.la -rw-r--r-- 1 root root 96816 Mar 17 17:55 gobject.so drwxr-xr-x 2 root root 4096 Mar 29 13:07 gtk -rw-r--r-- 1 root root 1243 Nov 16 2004 gtkhtml2.la -rw-r--r-- 1 root root 15808 Nov 16 2004 gtkhtml2.so -rw-r--r-- 1 root root 912 Mar 17 17:55 pango.la -rw-r--r-- 1 root root 71736 Mar 17 17:55 pango.so ls /urs/lib/python2.3/site-packages/gtk-2.0/gtk: -rw-r--r-- 1 root root5166 Mar 17 17:55 __init__.py -rw-r--r-- 1 root root6616 Mar 29 13:07 __init__.pyc -rw-r--r-- 1 root root6616 Mar 29 13:07 __init__.pyo -rw-r--r-- 1 root root1071 Mar 17 17:55 _gtk.la -rw-r--r-- 1 root root 1442032 Mar 17 17:55 _gtk.so -rw-r--r-- 1 root root2630 Mar 17 17:55 compat.py -rw-r--r-- 1 root root2892 Mar 29 13:07 compat.pyc -rw-r--r-- 1 root root2892 Mar 29 13:07 compat.pyo -rw-r--r-- 1 root root1136 Mar 17 17:55 glade.la -rw-r--r-- 1 root root 15864 Mar 17 17:55 glade.so -rw-r--r-- 1 root root 30075 Mar 17 17:55 keysyms.py -rw-r--r-- 1 root root 64158 Mar 29 13:07 keysyms.pyc -rw-r--r-- 1 root root 64158 Mar 29 13:07 keysyms.pyo ls /urs/lib/python2.3/site-packages/gtk-2.0/gnome: -rw-r--r-- 1 root root281 Nov 16 2004 __init__.py -rw-r--r-- 1 root root372 Dec 2 09:53 __init__.pyc -rw-r--r-- 1 root root372 Dec 2 09:53 __init__.pyo -rw-r--r-- 1 root root 1306 Nov 16 2004 _gnome.la -rw-r--r-- 1 root root 28856 Nov 16 2004 _gnome.so -rw-r--r-- 1 root root 1764 Nov 16 2004 applet.la -rw-r--r-- 1 root root 14648 Nov 16 2004 applet.so -rw-r--r-- 1 root root 1154 Nov 16 2004 canvas.la -rw-r--r-- 1 root root 31160 Nov 16 2004 canvas.so -rw-r--r-- 1 root root 1845 Nov 16 2004 nautilus.la -rw-r--r-- 1 root root 18968 Nov 16 2004 nautilus.so -rw-r--r-- 1 root root 1685 Nov 16 2004 ui.la -rw-r--r-- 1 root root 127780 Nov 16 2004 ui.so -rw-r--r-- 1 root root 1221 Nov 16 2004 vfs.la -rw-r--r-- 1 root root 76276 Nov 16 2004 vfs.so ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] cannot import gnome
Hi, I have a Debian Sarge system with python 2.3 and python-gnome-2.6.1. Importing pygtk in the way described by the tutorial does not work: import pygtk pygtk.require(2.0) import gtk import gnome Traceback (most recent call last): File stdin, line 1, in ? ImportError: No module named gnome However, when I do not import pygtk import gnome does work: import gtk import gnome I came across this problem because pybliographic did not start. It import gtk and gnome after pygtk. The hal-device-manager works correctly, because it does not first import pygtk. Is this a feature change that should be reflected into the code of the applications, or is this a bug? Bye, Martijn Brouwer ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] How to use show signal
I do not succeed in using the show signal. To isolate my problem I have written this Hello World program: import gtk import gtk.glade def HelloWorld(widget): print Hello World! dic={on_window1_show: HelloWorld} Widgets=gtk.glade.XML(onshow.glade, window1) Widgets.signal_autoconnect(dic) gtk.main() In my glade file I have connected the show signal of the mainwindow to the on_window1_show handler. When I run this program, the window (which only shows a label) is showed correctly, but the HelloWorld function is not called. Where is my mistake? Thanks in advance for helping, Martijn Brouwer ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] How to use show signal
On Tue, 2004-11-23 at 21:20 +, Gustavo J. A. M. Carneiro wrote: On Tue, 2004-11-23 at 20:51 +0100, Martijn Brouwer wrote: You are connecting the signal _after_ it being emitted. Try setting the 'visibile' property of window to false, in glade. Then, in the code, connect your signal and then manually show the window, with Widgets.get_widget(window1).show(). Your callback will then be invoked. Thanks for your fast answer. Your suggestion works partially. I changed my test program to what is shown below. import gtk import gtk.glade import time def HelloWorld(widget): print Hello World! dic={on_window1_show: HelloWorld} Widgets=gtk.glade.XML(onshow.glade, window1) Widgets.signal_autoconnect(dic) print show the window Widgets.get_widget(window1).show() time.sleep(1) print hide the window Widgets.get_widget(window1).hide() time.sleep(1) print show it again Widgets.get_widget(window1).show() gtk.main() When I run this program, the output on the console is: show the window hide the window show it again Hello World! The program window only appears after the *second* invocation of show(), just as Hello World! is only printed the second time. Apperently, the connection of the signal works. By why is nothing happening on the first invocation? Bye, Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] How to use show signal
Yes, I did. Martijn On Tue, 2004-11-23 at 17:28 -0500, Chris Lambacher wrote: Did you set window1 invisible in your glade file? Thanks for your fast answer. Your suggestion works partially. I changed my test program to what is shown below. import gtk import gtk.glade import time def HelloWorld(widget): print Hello World! dic={on_window1_show: HelloWorld} Widgets=gtk.glade.XML(onshow.glade, window1) Widgets.signal_autoconnect(dic) print show the window Widgets.get_widget(window1).show() time.sleep(1) print hide the window Widgets.get_widget(window1).hide() time.sleep(1) print show it again Widgets.get_widget(window1).show() gtk.main() When I run this program, the output on the console is: show the window hide the window show it again Hello World! The program window only appears after the *second* invocation of show(), just as Hello World! is only printed the second time. Apperently, the connection of the signal works. By why is nothing happening on the first invocation? ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] periodically perform an action
Hi, I would like to have my pygtk program call a function once every xx seconds. My purpose is to update some information, say, every 30 seconds. In an plain python program I would call sleep(xx) between the function calls. Since I am new to programming in event driven interfaces, I do not know to do this in a gtk interface. I guess, the gtk.mainloop has to take care for calling my function. How do I achieve this. Bye, Martijn Brouwer ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] python gtk/gnome editor
Shit happens. I don't blame you: you apoligized twice. Kind regards, Martijn On Thu, 17 Jul 2003 17:36:07 -0400 Shaffer, Chris [EMAIL PROTECTED] wrote: I'm actually very embarrassed by that... That first message is an email one of the users of my software here in my company send me... I would not wish that on any one... I truly am sorry, Martijn... Chris Shaffer -Original Message- From: Christian Reis [mailto:[EMAIL PROTECTED] Sent: Thursday, July 17, 2003 5:34 PM To: Shaffer, Chris Subject: Re: [pygtk] python gtk/gnome editor On Thu, Jul 17, 2003 at 05:14:42PM -0400, Shaffer, Chris wrote: All I ask is that you leave this alone because I have to FIX the updates!! This means I have to go in and correct everything that I have already fixed back to the way I want them. -Original Message- From: Martijn Brouwer [mailto:[EMAIL PROTECTED] I spent about 1 minute trying to figure out why you were flaming Martijn after such a polite request. ;) Take care, -- Christian Reis, Senior Engineer, Async Open Source, Brazil. http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL * The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] python gtk/gnome editor
Hi, For a program I am writing I need a text editor that is written in Python and has a gtk2 or gnome2 interface. I searched freshmeat but found nothing. I contacted the author of Moleskine quit some time ago and he said he would come up with at gtk2 version, but the developement seems quite dead. Is there somebody who knows a suitable program or is writing one? At this moment a wealth of features is not important for me, but for the future I would like to have syntax hightlighting. I considered writing one myself, but I am not even spending enough time on my own application, so this hardly an option. Is gtk SourceWidget (being) ported? I guess that when this is widget is available, writing a editor will be relatively easy. Martijn -- Physics is a approximate description of a part of the physical phenomena, that are only a small portion of human perceptions. H Casimir, Dutch Physicist ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] gdk geometry for a gtk.Window.set_geometry_hints()
Hi, I need a GdkGeometry struct for use in a gtk.Window.set_geometry_hints() command, but I cannot find how to create such an object. I imported gtk and then gtk.gdk, but dir(gtk.gdk) did not show me anything relevant. Martijn -- Physics is a approximate description of a part of the physical phenomena, that are only a small portion of human perceptions. H Casimir, Dutch Physicist ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] gdk geometry for a gtk.Window.set_geometry_hints()
Hi, I need a GdkGeometry struct for use in a gtk.Window.set_geometry_hints() command, but I cannot find how to create such an object. I imported gtk and then gtk.gdk, but dir(gtk.gdk) did not show me anything relevant. Martijn -- Physics is a approximate description of a part of the physical phenomena, that are only a small portion of human perceptions. H Casimir, Dutch Physicist ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] position in scrolled window
Hi, I have added a scrolled window to my application. I want it to display always the lowest part of the widget inside it (a gtk.textview). How can I achieve this? Bye, Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] is this C code?
On Sun, 9 Feb 2003 22:55:11 +0100 Martijn Brouwer [EMAIL PROTECTED] wrote: I read this code example in the faq about caputering key strokes. I do not understand the meaning of *args. It looks like a c pointer ;-) I guess it is something else, but I could not find anything in the python docs. Bye, Martijn def on_key_press(widget, event, *args): key = event.keyval if key 256: # chr() breaks if key = 256 print Key was pressed: %s (%s) % ( chr(key), key ) # w = gtk.GtkWindow() w.connect('key_press_event', on_key_press) David, Christian, Federico and Johan. Thanks! Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] is this C code?
I read this code example in the faq about caputering key strokes. I do not understand the meaning of *args. It looks like a c pointer ;-) I guess it is something else, but I could not find anything in the python docs. Bye, Martijn def on_key_press(widget, event, *args): key = event.keyval if key 256: # chr() breaks if key = 256 print Key was pressed: %s (%s) % ( chr(key), key ) # w = gtk.GtkWindow() w.connect('key_press_event', on_key_press) ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] [cvs] compilation of atk.c fails
On 16 Jan 2003 11:47:20 -0200 Johan Dahlin [EMAIL PROTECTED] wrote: Strange. I seems that the code generator was interrupted when generating atk.c Try to remove atk.c (it's generated) and the build/ directory (it's used by distutils) If it still doesn't work, could you send me a more detailed bug report with gcc version, python version and the broken atk.c. I removed the atk.c file, the build dir, did cvs update, but rebuilding gave the same results. gcc 2.95.4, on debian sarge. python 2.2. I have attached atk.c. Looking on the output of atk.c it looks like the error is in the following part of the code, codegen/codegen.py line 665 # This is working well bymod = {} for module, pyname, cname in imports: bymod.setdefault(module, []).append((pyname, cname)) fp.write('PyObject *module;\n\n') # Here it stops for module in bymod: fp.write('if ((module = PyImport_ImportModule() fp.write(' PyObject *moddict = PyModul) It might be due to a bogus import statement of some kind. Could you try to add a debug output and print out bmod just before that. And modify setup.py to print out the argument send to the codegenerator? (add a print s on line 225 in setup.py) Strange things are happening. When I add some print statements to codegen.py, they are not printed to the screen but into atk.c! The value of bymod printed there is: {'gobject': [('GObject', 'PyGObject_Type')]} I have included both atk.c and codegen.py in a attachment. Bye and Thanks, Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] debugging pygtk
Hi John, I is a good idea to contact eachother by i.c.q. about this problem? Is faster than mailing once or twice a day... Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] [cvs] compilation of atk.c fails
On 16 Jan 2003 11:47:20 -0200 Johan Dahlin [EMAIL PROTECTED] wrote: Looking on the output of atk.c it looks like the error is in the following part of the code, codegen/codegen.py line 665 # This is working well bymod = {} for module, pyname, cname in imports: bymod.setdefault(module, []).append((pyname, cname)) fp.write('PyObject *module;\n\n') # Here it stops for module in bymod: fp.write('if ((module = PyImport_ImportModule() fp.write(' PyObject *moddict = PyModul) It might be due to a bogus import statement of some kind. Could you try to add a debug output and print out bmod just before that. And modify setup.py to print out the argument send to the codegenerator? (add a print s on line 225 in setup.py) The codegenerator is not run: The function self.check_dates() from Template.generate() returns 1 so Template.generate() returns without running codegen.py. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] [cvs] compilation of atk.c fails
On 16 Jan 2003 20:47:34 -0200 Johan Dahlin [EMAIL PROTECTED] wrote: It might be due to a bogus import statement of some kind. Could you try to add a debug output and print out bmod just before that. And modify setup.py to print out the argument send to the codegenerator? (add a print s on line 225 in setup.py) The codegenerator is not run: The function self.check_dates() from Template.generate() returns 1 so Template.generate() returns without running codegen.py. You must remove atk.c to make the codegenerator run again (or touch atk.defs) Here the codegen command string. The rest I will do tomorrow, my bed and my wife are waiting ;-) python codegen/codegen.py --register atk-types.defs --override atk.override --prefix pyatk atk.defs atk.c Bye, Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] [cvs] compilation of atk.c fails
When I compile pygtk using distuitls (./setup.py install --prefix=/home/martijn/sys/) compilation of atk.c fails with: building 'atk' extension skipping atkmodule.c (build/temp.linux-i686-2.2/atkmodule.o up-to-date) gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DVERSION=1.99.14 -DPYGTK_MAJOR_VERSION=1 -DPYGTK_MINOR_VERSION=99 -DPYGTK_MICRO_VERSION=14 -I/usr/include/atk-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I. -Igtk -I/usr/include/python2.2 -c atk.c -o build/temp.linux-i686-2.2/atk.o atk.c: In function `pyatk_register_classes': atk.c:1569: parse error at end of input error: command 'gcc' failed with exit status 1 Am I doing something wrong or is this an error in the repository? Bye, Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] [cvs] compilation of atk.c fails
On 13 Jan 2003 17:03:24 -0200 Johan Dahlin [EMAIL PROTECTED] wrote: mån 2003-01-13 klockan 16.53 skrev Martijn Brouwer: When I compile pygtk using distuitls (./setup.py install --prefix=/home/martijn/sys/) compilation of atk.c fails with: building 'atk' extension skipping atkmodule.c (build/temp.linux-i686-2.2/atkmodule.o up-to-date) gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DVERSION=1.99.14 -DPYGTK_MAJOR_VERSION=1 -DPYGTK_MINOR_VERSION=99 -DPYGTK_MICRO_VERSION=14 -I/usr/include/atk-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I. -Igtk -I/usr/include/python2.2 -c atk.c -o build/temp.linux-i686-2.2/atk.o atk.c: In function `pyatk_register_classes': atk.c:1569: parse error at end of input error: command 'gcc' failed with exit status 1 Strange. I seems that the code generator was interrupted when generating atk.c Try to remove atk.c (it's generated) and the build/ directory (it's used by distutils) If it still doesn't work, could you send me a more detailed bug report with gcc version, python version and the broken atk.c. I removed the atk.c file, the build dir, did cvs update, but rebuilding gave the same results. gcc 2.95.4, on debian sarge. python 2.2. I have attached atk.c. Thanks for the quick reply Martijn /* -*- Mode: C; c-basic-offset: 4 -*- */ #include Python.h #line 4 atk.override #include Python.h #include pygobject.h #include atk/atk.h #include atk/atknoopobjectfactory.h #include atk/atknoopobject.h #line 15 atk.c /* -- types from other modules -- */ static PyTypeObject *_PyGObject_Type; #define PyGObject_Type (*_PyGObject_Type) /* -- forward type declarations -- */ PyTypeObject PyAtkHyperlink_Type; PyTypeObject PyAtkObject_Type; PyTypeObject PyAtkNoOpObject_Type; PyTypeObject PyAtkObjectFactory_Type; PyTypeObject PyAtkNoOpObjectFactory_Type; PyTypeObject PyAtkRegistry_Type; PyTypeObject PyAtkRelation_Type; PyTypeObject PyAtkRelationSet_Type; PyTypeObject PyAtkStateSet_Type; PyTypeObject PyAtkUtil_Type; /* --- AtkHyperlink --- */ static int pygobject_no_constructor(PyObject *self, PyObject *args, PyObject *kwargs) { gchar buf[512]; g_snprintf(buf, sizeof(buf), %s is an abstract widget, self-ob_type-tp_name); PyErr_SetString(PyExc_NotImplementedError, buf); return -1; } static PyObject * _wrap_atk_hyperlink_get_uri(PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { i, NULL }; gchar *ret; int i; if (!PyArg_ParseTupleAndKeywords(args, kwargs, i:AtkHyperlink.get_uri, kwlist, i)) return NULL; ret = atk_hyperlink_get_uri(ATK_HYPERLINK(self-obj), i); if (ret) { PyObject *py_ret = PyString_FromString(ret); g_free(ret); return py_ret; } Py_INCREF(Py_None); return Py_None; } static PyObject * _wrap_atk_hyperlink_get_object(PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { i, NULL }; AtkObject *ret; int i; if (!PyArg_ParseTupleAndKeywords(args, kwargs, i:AtkHyperlink.get_object, kwlist, i)) return NULL; ret = atk_hyperlink_get_object(ATK_HYPERLINK(self-obj), i); /* pygobject_new handles NULL checking */ return pygobject_new((GObject *)ret); } static PyObject * _wrap_atk_hyperlink_get_end_index(PyGObject *self) { int ret; ret = atk_hyperlink_get_end_index(ATK_HYPERLINK(self-obj)); return PyInt_FromLong(ret); } static PyObject * _wrap_atk_hyperlink_get_start_index(PyGObject *self) { int ret; ret = atk_hyperlink_get_start_index(ATK_HYPERLINK(self-obj)); return PyInt_FromLong(ret); } static PyObject * _wrap_atk_hyperlink_is_valid(PyGObject *self) { PyObject *py_ret; int ret; ret = atk_hyperlink_is_valid(ATK_HYPERLINK(self-obj)); py_ret = ret ? Py_True : Py_False; Py_INCREF(py_ret); return py_ret; } static PyObject * _wrap_atk_hyperlink_get_n_anchors(PyGObject *self) { int ret; ret = atk_hyperlink_get_n_anchors(ATK_HYPERLINK(self-obj)); return PyInt_FromLong(ret); } static PyMethodDef _PyAtkHyperlink_methods[] = { { get_uri, (PyCFunction)_wrap_atk_hyperlink_get_uri, METH_VARARGS|METH_KEYWORDS }, { get_object, (PyCFunction)_wrap_atk_hyperlink_get_object, METH_VARARGS|METH_KEYWORDS }, { get_end_index, (PyCFunction)_wrap_atk_hyperlink_get_end_index, METH_NOARGS }, { get_start_index, (PyCFunction)_wrap_atk_hyperlink_get_start_index, METH_NOARGS }, { is_valid, (PyCFunction)_wrap_atk_hyperlink_is_valid, METH_NOARGS }, { get_n_anchors, (PyCFunction)_wrap_atk_hyperlink_get_n_anchors, METH_NOARGS }, { NULL, NULL, 0 } }; PyTypeObject PyAtkHyperlink_Type = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ atk.Hyperlink, /* tp_name */ sizeof(PyGObject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ (destructor)0, /* tp_dealloc */ (printfunc)0, /* tp_print */ (getattrfunc)0
Re: [pygtk] [cvs] compilation of atk.c fails
On 13 Jan 2003 17:03:24 -0200 Johan Dahlin [EMAIL PROTECTED] wrote: mån 2003-01-13 klockan 16.53 skrev Martijn Brouwer: When I compile pygtk using distuitls (./setup.py install --prefix=/home/martijn/sys/) compilation of atk.c fails with: building 'atk' extension skipping atkmodule.c (build/temp.linux-i686-2.2/atkmodule.o up-to-date) gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DVERSION=1.99.14 -DPYGTK_MAJOR_VERSION=1 -DPYGTK_MINOR_VERSION=99 -DPYGTK_MICRO_VERSION=14 -I/usr/include/atk-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I. -Igtk -I/usr/include/python2.2 -c atk.c -o build/temp.linux-i686-2.2/atk.o atk.c: In function `pyatk_register_classes': atk.c:1569: parse error at end of input error: command 'gcc' failed with exit status 1 Strange. I seems that the code generator was interrupted when generating atk.c Try to remove atk.c (it's generated) and the build/ directory (it's used by distutils) If it still doesn't work, could you send me a more detailed bug report with gcc version, python version and the broken atk.c. I remeved the atk.c file, the build dir, did cvs update, but rebuilding gave the same results. gcc 2.95.4, on debian sarge. python 2.2. I have attached atk.c. Thanks for the quick reply /* -*- Mode: C; c-basic-offset: 4 -*- */ #include Python.h #line 4 atk.override #include Python.h #include pygobject.h #include atk/atk.h #include atk/atknoopobjectfactory.h #include atk/atknoopobject.h #line 15 atk.c /* -- types from other modules -- */ static PyTypeObject *_PyGObject_Type; #define PyGObject_Type (*_PyGObject_Type) /* -- forward type declarations -- */ PyTypeObject PyAtkHyperlink_Type; PyTypeObject PyAtkObject_Type; PyTypeObject PyAtkNoOpObject_Type; PyTypeObject PyAtkObjectFactory_Type; PyTypeObject PyAtkNoOpObjectFactory_Type; PyTypeObject PyAtkRegistry_Type; PyTypeObject PyAtkRelation_Type; PyTypeObject PyAtkRelationSet_Type; PyTypeObject PyAtkStateSet_Type; PyTypeObject PyAtkUtil_Type; /* --- AtkHyperlink --- */ static int pygobject_no_constructor(PyObject *self, PyObject *args, PyObject *kwargs) { gchar buf[512]; g_snprintf(buf, sizeof(buf), %s is an abstract widget, self-ob_type-tp_name); PyErr_SetString(PyExc_NotImplementedError, buf); return -1; } static PyObject * _wrap_atk_hyperlink_get_uri(PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { i, NULL }; gchar *ret; int i; if (!PyArg_ParseTupleAndKeywords(args, kwargs, i:AtkHyperlink.get_uri, kwlist, i)) return NULL; ret = atk_hyperlink_get_uri(ATK_HYPERLINK(self-obj), i); if (ret) { PyObject *py_ret = PyString_FromString(ret); g_free(ret); return py_ret; } Py_INCREF(Py_None); return Py_None; } static PyObject * _wrap_atk_hyperlink_get_object(PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { i, NULL }; AtkObject *ret; int i; if (!PyArg_ParseTupleAndKeywords(args, kwargs, i:AtkHyperlink.get_object, kwlist, i)) return NULL; ret = atk_hyperlink_get_object(ATK_HYPERLINK(self-obj), i); /* pygobject_new handles NULL checking */ return pygobject_new((GObject *)ret); } static PyObject * _wrap_atk_hyperlink_get_end_index(PyGObject *self) { int ret; ret = atk_hyperlink_get_end_index(ATK_HYPERLINK(self-obj)); return PyInt_FromLong(ret); } static PyObject * _wrap_atk_hyperlink_get_start_index(PyGObject *self) { int ret; ret = atk_hyperlink_get_start_index(ATK_HYPERLINK(self-obj)); return PyInt_FromLong(ret); } static PyObject * _wrap_atk_hyperlink_is_valid(PyGObject *self) { PyObject *py_ret; int ret; ret = atk_hyperlink_is_valid(ATK_HYPERLINK(self-obj)); py_ret = ret ? Py_True : Py_False; Py_INCREF(py_ret); return py_ret; } static PyObject * _wrap_atk_hyperlink_get_n_anchors(PyGObject *self) { int ret; ret = atk_hyperlink_get_n_anchors(ATK_HYPERLINK(self-obj)); return PyInt_FromLong(ret); } static PyMethodDef _PyAtkHyperlink_methods[] = { { get_uri, (PyCFunction)_wrap_atk_hyperlink_get_uri, METH_VARARGS|METH_KEYWORDS }, { get_object, (PyCFunction)_wrap_atk_hyperlink_get_object, METH_VARARGS|METH_KEYWORDS }, { get_end_index, (PyCFunction)_wrap_atk_hyperlink_get_end_index, METH_NOARGS }, { get_start_index, (PyCFunction)_wrap_atk_hyperlink_get_start_index, METH_NOARGS }, { is_valid, (PyCFunction)_wrap_atk_hyperlink_is_valid, METH_NOARGS }, { get_n_anchors, (PyCFunction)_wrap_atk_hyperlink_get_n_anchors, METH_NOARGS }, { NULL, NULL, 0 } }; PyTypeObject PyAtkHyperlink_Type = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ atk.Hyperlink, /* tp_name */ sizeof(PyGObject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ (destructor)0, /* tp_dealloc */ (printfunc)0, /* tp_print */ (getattrfunc)0
[pygtk] How to configure Text Tags
I have problems creating a read-only tag in gtk.TextBuffer. I have the following information: 1) from the API documentation of gtk.TextView: gtk.TextView.set_editable def set_editable(setting) setting : whether it's editable Sets the default editability of the gtk.TextView. You can override this default setting with tags in the buffer, using the editable attribute of tags. So I have to change the editable atribute of my tag. 2) from the API documentation of gtk.TextTag: Constructor def __init__(name) name : tag name, or NULL Returns : a new gtk.TextTag Creates a gtk.TextTag. Configure the tag using object arguments, i.e. using g_object_set(). 3) From the API documentation of gtk.TextBuffer: gtk.TextBuffer.create_tag def create_tag(tag_name, first_property_name) tag_name : name of the new tag, or NULL first_property_name : name of first property to set, or NULL Returns : a new tag Creates a tag and adds it to the tag table for buffer. Equivalent to calling gtk.TextTag() and then adding the tag to the buffer's tag table. The returned tag is owned by the buffer's tag table, so the ref count will be equal to one. If tag_name is NULL, the tag is anonymous. If tag_name is non-NULL, a tag called tag_name must not already exist in the tag table for this buffer. The first_property_name argument and subsequent arguments are a list of properties to set on the tag, as with g_object_set() If I understand this well 3) contradicts 2) and is incorrect. It says that you can give more than a single parameter to the constructor, which is not true. I can create a tag using self.Buffer.ReadOnly=self.Buffer.create_tag('ReadOnly') But when I check whether it is editable using: self.Buffer.ReadOnly.get_property('readonly') python complains: TypeError: the object does not support the given parameter What am I doing wrong? And where can I find a list of tag properties that I can change? Bye, Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Python does not find PyGtk
On Mon, 06 Jan 2003 10:54:12 +0800 James Henstridge [EMAIL PROTECTED] wrote: Martijn Brouwer wrote: That was what I understood from the faq too, however it seems that 1.99 requires importation of pygtk before gtk even when only one version of pygtk is installed. I have python 2.2 with gnome-python 1.99.13. On my system (debian testing) gnome-python 1.4 based on pygtk 0.69.3 is installed in combination with python 2.1. (in python2.1/site-packages) This might be an artefact of the debian packaging. It works fine compiled from tarballs (and on other distros). PyGtk 199.13 is from a tarball. But it works now, I am exploring the possibilities, so I do not complain anymore. Perhaps it is an idea to make things a little more transparent, as already suggested by other people on this list. Bye, Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Embedding interactive programs
On Thu, 2 Jan 2003 11:52:46 -0200 Christian Reis [EMAIL PROTECTED] wrote: On Thu, Jan 02, 2003 at 08:50:39AM +0100, Martijn Brouwer wrote: Hi, I would like to write an gtk/gnome frondend to an interactive program. This can be easily done using the zvt terminal widget. However I would like my application to be able to communicate with the interactive program without displaying this on the terminal. This paragraph is very hard to understand. Can you elaborate? I would like to be able to communicate in two ways with an interactive program: 1) by the user. This should be visible in a terminal. 2) by the graphical frontend application. This should be hidden from the user. I could use a zvt terminal, fork the interactive program and let the user communicate with the interactive program. In this case communication type 1) is trivial. But as far as I know, type 2 communication is not possible in this case, since all input to and from the interactive program has to go through the zvt terminal. When I do not fork the interactive program from the terminal but communicate through i.e. pexpect with the interactive program, it is easy to forward the output the a terminal using zvt_term_feed. The problem now is to receive the user input from the terminal. I hope I made my intensions clear now. Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Embedding interactive programs
On Thu, 2 Jan 2003 16:14:50 -0200 Christian Reis [EMAIL PROTECTED] wrote: On Thu, Jan 02, 2003 at 08:50:39AM +0100, Martijn Brouwer wrote: I would like to be able to communicate in two ways with an interactive program: What does `interactive program' mean? A program that uses a terminal to input data (like Autocad's command-line prompt?) I don't know about autocad, the program I mean is octave (www.octave.org). I is an matlab like interpreter for numerical calculations. Just like the python interpreter it can interpret command from a shell. The user types a command, which is processed by the interpreter. After processing, and possibly output of the result, a prompt is presented and the user can enter a new command. 1) by the user. This should be visible in a terminal. So what the user types shows up in the terminal, as expected? Yes. 2) by the graphical frontend application. This should be hidden from the user. I could use a zvt terminal, fork the interactive program and let the user communicate with the interactive program. In this case communication type 1) is trivial. But as far as I know, type 2 communication is not possible in this case, since all input to and from the interactive program has to go through the zvt terminal. When You could communicates using pipes, even using input_add(), no? Johan has fixed up a version of the original pygtk test script that he calls `console.py' that does IPC with Python, maybe he'd be nice enough to share it with you. My first ideas were about communicating with pipes. After some reading I decided to look for something else, since I need two-way communication. When pipes are used, 'deadlocks' may occur: situations where both programs are waiting for input from the other site. Apart from that I must admit I still don't know what you mean. Maybe an example with more concrete information App X does this, has window, etc.. I want to make a graphical shell for octave, which allows the user to use it as if he was using it in its normal environment. Additionally I want my application to be able to communicate with octave without the user noticing. This is necessary for adding additional functionality over just a simple graphical shell. Hope I finally managed to make clear what I intend. Bye, Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Embedding interactive programs
On Thu, 2 Jan 2003 15:41:49 -0500 Andrew Reid [EMAIL PROTECTED] wrote: I have something which may be related -- we had a requirement for a command-line console which could operate while our application was in GUI mode, which we used mainly for debugging the GUI. It subclasses the Python InteractiveConsole and wraps it in a PyGtk text window, which allows you to textually interrogate and modify Python objects in whatever namespace you like. The effect is a kind of interactive scripting. This is definitely a Python beast, though. If your app is Python, it may be useful, but it doesn't know anything about Octave. I have a standalone version of this code, which I could send you if you like. Thanks for your reply! I read the docs for the interactive console. It allows the user to input python commands, which is not what I want: the user should answer octave commands. But you pointed me in a promising direction anyway. I am looking now to the GtkTextView widget, which looks promising. Thanks, Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Embedding interactive programs
Hi, I would like to write an gtk/gnome frondend to an interactive program. This can be easily done using the zvt terminal widget. However I would like my application to be able to communicate with the interactive program without displaying this on the terminal. When the application is forked using zvt_fork_pty, the only way to communicate with the interactive program is through the terminal, which automatically displays everthing, so this option does not work. A second method might be using the terminal just for user I/O and doing all communication with the program from my application. Writing text to the terminal is straightforward, but reading input can only be done by reading a part of the terminal screen, which is quite awkward in my opinion. Does anybody has ideas about alternatives, using for instance a TextView widget? This is not very elegant too, since it makes no discrimination between program output and user input. I hope someone on the list can point me in the right direction. Please read 'as far as I know' everywhere were it is appropriate in what I wrote: I am just starting with PyGtk. Thanks, Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Python does not find PyGtk
That was what I understood from the faq too, however it seems that 1.99 requires importation of pygtk before gtk even when only one version of pygtk is installed. I have python 2.2 with gnome-python 1.99.13. On my system (debian testing) gnome-python 1.4 based on pygtk 0.69.3 is installed in combination with python 2.1. (in python2.1/site-packages) On Sun, 29 Dec 2002 15:55:04 -0800 John Finlay [EMAIL PROTECTED] wrote: My understanding is that this is only required if you have both PyGTK 0.6.11 and PyGTK 1.99.13 installed together. Are there other circumstances where this is required? Thanks john Martijn Brouwer wrote: On Sat, 28 Dec 2002 23:18:30 +0100 Tom Cato Amundsen [EMAIL PROTECTED] wrote: ImportError: No module named gtk I guess you forgot to import pygtk pygtk.require(2.0) before import gtk No I did not forget it, I just did not know I had to. :) Now I read something about it in a section of the faq I skipped because I was not upgrading from an earlier version. This issue is not in John Finlay's tutorial though allthough the tutorial is dated from 1 december. I will drop him a kind notice. Thanks for your help! Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Python does not find PyGtk
On Sat, 28 Dec 2002 23:18:30 +0100 Tom Cato Amundsen [EMAIL PROTECTED] wrote: ImportError: No module named gtk I guess you forgot to import pygtk pygtk.require(2.0) before import gtk No I did not forget it, I just did not know I had to. :) Now I read something about it in a section of the faq I skipped because I was not upgrading from an earlier version. This issue is not in John Finlay's tutorial though allthough the tutorial is dated from 1 december. I will drop him a kind notice. Thanks for your help! Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Python does not find PyGtk
I have two versions of python installed (2.1 and 2.2) on a linux system running debian testing. For 2.1 I have PyGtk installed using the packages from the distribution, which works fine. Now I want to write a program myself using PyGtk and Gnome-Python version 1.99.13. Both are now installed in /home/martijn/sys/lib/python2.2/sitepackages. The listing of this directory looks like everything is OK. drwxr-xr-x5 martijn users4096 Dec 27 16:08 gtk-2.0 -rw-r--r--1 martijn users 8 Dec 26 23:12 pygtk.pth -rw-r--r--1 martijn users2092 Dec 26 23:12 pygtk.py -rw-r--r--1 martijn users1841 Dec 26 23:12 pygtk.pyc -rw-r--r--1 martijn users1504 Dec 26 23:12 pygtk.pyo Yet, when I export PYTHONPATH=/home/martijn/sys/lib/python2.2/sitepackages and start the python interpreter (2.2) I cannot import gtk: ImportError: No module named gtk What is missing? sys.path is ['', '/home/martijn/sys/lib/python2.2/site-packages', '/usr/lib/python2.2', '/usr/lib/python2.2/plat-linux2', '/usr/lib/python2.2/lib-tk', '/usr/lib/python2.2/lib-dynload', '/usr/local/lib/python2.2/site-packages', '/usr/lib/python2.2/site-packages', '/usr/lib/python2.2/site-packages/Numeric', '/usr/lib/site-python'] What is missing. I would really like to run the helloworld program from the tutorial ;-) Thanks for helping Martijn ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/