Re: [pygtk] Py_Shell.py
Hi Pier, Thank you thank you THANK YOU! it's working! =D Your second solution was the way to go, with a little twist. First I added locals() to InteractiveInterpreter (it is InteractiveInterpreter instead of InteractiveConsole, your line number was right), but I only got the dictionary from Py_Shell.py. I actually wanted the dictionary from Gui.py that has got Py_Shell embedded. So, I got the locals() from Gui.py right before instantiating Shell_Gui and passed to Shell_Gui as an additional parameter (sim_locals). Then in the Shell_Gui __init__, I did pretty much what you said to do: self.core=code.InteractiveInterpreter(sim_locals) Now the embedded python console have access to all the functions and variables that are loaded with the gui. Sincerely, ~ Yang p.s. now i just have to fix the error with pygtk.require('2.0') so i can use your latest version of Py_Shell :) On Wed, 2003-11-05 at 05:44, Pier Carteri wrote: > Hi Yang, > I'm not sure to undestand well you question (feel free to correct me). > There are two possibilities: the former is use Py_Shell to load your > program, but this way can be really difficult especially if the program > you load is a gui (with gui I mean something that call the > gtk.main_loop) because the second call to main_loop will freeze the > Py_Shell interface; a lot of work should be done to avoid possible > deadlock etc., and this is a bit out of scope for Py_Shell. > > The latter way is create your gui which embed Py_Shell and pass to the > shell a local dictionary. I'm going to explain last sentence (that's not > clear also to me :-)) > Py_Shell is based on InteractiveConsole (IC) (InteractiveConsole and > InteractiveInterpreter are located into the code module, you can see the > python doc for more infos). When you create an IC object you can pass it > a dictionary; every command send to the IC will be executed into the > environment based on that dictionary so this is probably what you are > looking for . > > So try somethings like this: in Py_Shell change the line where it's > created the InteractiveConsole (around line 287) > > self.core=code.InteractiveConsole() > > and replace with > > self.core=code.InteractiveConsole(locals()) > > Hope this helps > > Best regards! > Pier > > Il mar, 2003-11-04 alle 23:55, Yang Zheng ha scritto: > > Hello Pier, > > > > That fixed my problem, thanks a lot for your program and help! > > > > I know this is going to be a bit out of scope of the GUI, but I was > > wondering if it's possible for this Py_Shell to be the original shell > > that is used to load up the gui in the first place. Say I have this > > Gui.py that loads up functions, variables, and the glade stuff. When I > > run it, the gui pops out, with your Py_Shell embedded inside. > > Currently, the Py_Shell inside the gui is a completely new one that has > > no knowlege of the Gui.py functions/variables. Is there a way for > > Py_Shell to have acess to them? > > > > thanks again, > > ~ Yang > > > > > > On Tue, 2003-11-04 at 11:46, Pier Carteri wrote: > > > Hi Yang! > > > main_shell=Py_Shell.Shell_Gui(with_window=0) > > > > xml.get_widget("vpaned1").add2(main_shell.gui) > > > > > > I've looked to my code, I think the solution is that you miss a > > > main_shell.gui.show_all() > > > In my code I call it with the empty frame, that's why you see only the > > > frame. > > > You ca fix it: > > > put line 313 " frame.show_all()" after line 314 "frame.add(box)" > > > > > > > >>> import pygtk > > > > >>> pygtk.require('2.0') > > > > Traceback (most recent call last): > > > > File "", line 1, in ? > > > > File "pygtk.py", line 73, in require > > > > assert versions.has_key(version), \ > > > > AssertionError: required version '2.0' not found on system > > > > > > It seems that somethings is wrong with your configuration; are you sure > > > you have installed pygtk into the right location? The script doesn't > > > find the required version of pygtk > > > > > > Hope this help! > > > > > > Best regards! > > > > > > Pier > > > > > > ___ > > > 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 mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] difference between pipes in python and C?
Hallo all, I know that my question is kind out of topic but since I use pygtk for this small project and on this list there are people which are familiar with C I will dare to ask. I'm new to python and do like it. For learning purposes I decided to write a simple GUI for mencoder using pygtk but I have a problem regarding the user feedback. Can somebody tell me why these two programs have different output? I mean - why python's pipe "eat up" the debugging information printed by mencoder to stderr preventing me from presenting a nice progress bar to the user? Many thanks and sorry for the off topic question - Velko --- #!/usr/bin/python import os def main(): f = os.popen('mencoder -dvd 1 -chapter 1-1 -ovc copy -oac copy -o delme.avi 2>&1') if f == None: return line = None while line != '': line = f.readline() print line f.close() return main() --- #include int main(int argc, char *argv[]) { FILE *f = NULL; char buf[1024]; size_t request = sizeof(buf); f = popen("mencoder -dvd 1 -chapter 1-1 -ovc copy -oac copy -o delme.avi 2>&1", "r"); if(!f) return 1; while(fread(buf, request - 1, 1, f) == 1) { buf[request - 1] = '\0'; fprintf(stderr, "%s\n", buf); } fprintf(stderr, "%s\n", buf); pclose(f); return 0; } -- Two computer people discussing those old stories about Bill Gates' name adding up to 666 in ASCII: "I hear that if you play the NT 4.0 CD backward, you get a satanic message." "That's nothing. If you play it forward, it installs NT 4.0." - Anonymous ___ 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] pyGtk/C extension
David Farning wrote: - To create a python gtk widget from a C gtk widget: pygobject_new((GObject*) widget); If a python wrapper for 'widget' already exists, it will incref and return that, other wise it will create a new python wrapper object. Do you possibly have a concrete example for this? In particular, I have a a custom gtk treeModel that I would like to wrap? The method I described is really only useful for small things. For wrapping a new type, you would be best to use the "codegen" autogeneration system. There is a good tutorial here: http://www-106.ibm.com/developerworks/linux/library/l-wrap/ Looking at the source for pygtk is also a good source of information, but it's rather complex. You will need to download the source anyway to get the codegen package. -- Tim Evans Applied Research Associates NZ http://www.aranz.com/ ___ 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] pyGtk/C extension
On Wed, 2003-11-05 at 14:59, Tim Evans wrote: > Tobbi wrote: > >Hi, > > I'm actually developing an application standing at Gtk having two parts > > - Ansi C and Python. > > The problem I met is how to get a C pointer of Gtk object relating to > > Python pyGtk object and vice versa. > > > > Example: > > > > Python: > > button = gtk.Button() > > C: > > gtk_widget_destroy(button) > > > > I've found some solution speaking about "_o" field of pyGtk object. > > However my object doesn't seem to have such pointer. Also, the > > descriptions speak about gtk.GtkButton instead of gtk.Button. > > > > Is it version mismatch? I'm using pygtk-2.0 and python 2.2.x > > > > So, is there a way to get pointer to wrapped pygtk object? Is there a > > way to create pygtk wrapper to already existing gtk object? > > Others have already pointed out the difference between pygtk-0.6 and > 2.0, and that you are reading some outdate documentation. The following > is how to do it for pygtk-2.0. I'm assume that you already know how to > write a python extension in C. > > - Make your foomodule.c look like this: > >#include >#include >/* global variable declared at top of file */ >static PyTypeObject *PyGObject_Type=NULL; >/* ... */ >void initfoo(void) >{ >PyObject *module; >Py_InitModule("foo", foo_functions); > >init_pygobject(); >init_pygtk(); >module = PyImport_ImportModule("gobject"); >if (module) { >PyGObject_Type = > (PyTypeObject*)PyObject_GetAttrString(module, "GObject"); >Py_DECREF(module); >} >} > > - To create a python gtk widget from a C gtk widget: >pygobject_new((GObject*) widget); >If a python wrapper for 'widget' already exists, it will incref and >return that, other wise it will create a new python wrapper object. > Do you possibly have a concrete example for this? In particular, I have a a custom gtk treeModel that I would like to wrap? > - To get a pointer to the underlying C widget from a Python widget that >was passed as an argument, do something like this: > >PyGObject *py_widget; >GtkWidget *widget; > >if (!PyArg_ParseTuple(args, "O!", PyGObject_Type, &py_widget)) >return NULL; >widget = GTK_WIDGET(py_widget->obj); > > You might also want to look at the 'codegen' stuff that pygtk uses to > automatically generate most of the pygtk interface. Once you get used > to using it, it's much easier to use than writing everything by hand. Thanks Dave Farning ___ 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] pyGtk/C extension
On Thu, Nov 06, 2003 at 09:59:25AM +1300, Tim Evans wrote: > Tobbi wrote: > >I'm actually developing an application standing at Gtk having two parts > >- Ansi C and Python. > >The problem I met is how to get a C pointer of Gtk object relating to > >Python pyGtk object and vice versa. > > Others have already pointed out the difference between pygtk-0.6 and > 2.0, and that you are reading some outdate documentation. The following > is how to do it for pygtk-2.0. I'm assume that you already know how to > write a python extension in C. Added as FAQ 23.15: http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq23.015.htp Let me know if there's correcting to be done. Thanks! Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331 ___ 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] TreeView accessing every row of my custom TreeModel?
Hi, I'm implementing a custom TreeModel to display the contents of a large debug file. Things are working very well, except that when the model is first assigned to the view, the view walks through every row in the model before displaying! This makes the initial display very slow! Once the initial display is completed scolling around in the view is very fast. I wrote the custom TreeModel to avoid reading & parsing every line in the file until the line actually needed displaying. Is this the normal behavior of a TreeView or is there a bug somewhere? Jeff ___ 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] My menubar disappear with mysql
[helpwanted: Would anyone like to contribute a FAQ entry on ItemFactory garbage collection and how to avoid it? It's been asked multiple times before..] On Wed, Nov 05, 2003 at 10:20:51PM +0100, mc collilieux wrote: > After playing with gc (new for me), > gc.set_debug(gc.DEBUG_LEAK) -> gc: collectable 0x82248fc> > > The simple fact of write this line in my module can stop the problem ? > Surprises, but I am very beginner in > programmation (and in english too) > > To Christian : > Yes, usually, i don't use "from foo import *", it's only for testing and > trying understand the problem Okay, just making sure. > Thanks to everyone > > And now, the best way is using my new 'manual' menu ? You can just hold a Python reference to the factory (something like self.factory = factory, for instance) and it won't be garbage collected. Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331 ___ 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] My menubar disappear with mysql
Le Mon, 3 Nov 2003 23:30:30 +0100 mc collilieux <[EMAIL PROTECTED]> écrivait : Here the answer : After playing with gc (new for me), gc.set_debug(gc.DEBUG_LEAK) -> gc: collectable The simple fact of write this line in my module can stop the problem ? Surprises, but I am very beginner in programmation (and in english too) To Christian : Yes, usually, i don't use "from foo import *", it's only for testing and trying understand the problem Thanks to everyone And now, the best way is using my new 'manual' menu ? -- Marie-Claude Collilieux Bretagne ___ 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] pyGtk/C extension
Tobbi wrote: Hi, I'm actually developing an application standing at Gtk having two parts - Ansi C and Python. The problem I met is how to get a C pointer of Gtk object relating to Python pyGtk object and vice versa. Example: Python: button = gtk.Button() C: gtk_widget_destroy(button) I've found some solution speaking about "_o" field of pyGtk object. However my object doesn't seem to have such pointer. Also, the descriptions speak about gtk.GtkButton instead of gtk.Button. Is it version mismatch? I'm using pygtk-2.0 and python 2.2.x So, is there a way to get pointer to wrapped pygtk object? Is there a way to create pygtk wrapper to already existing gtk object? Others have already pointed out the difference between pygtk-0.6 and 2.0, and that you are reading some outdate documentation. The following is how to do it for pygtk-2.0. I'm assume that you already know how to write a python extension in C. - Make your foomodule.c look like this: #include #include /* global variable declared at top of file */ static PyTypeObject *PyGObject_Type=NULL; /* ... */ void initfoo(void) { PyObject *module; Py_InitModule("foo", foo_functions); init_pygobject(); init_pygtk(); module = PyImport_ImportModule("gobject"); if (module) { PyGObject_Type = (PyTypeObject*)PyObject_GetAttrString(module, "GObject"); Py_DECREF(module); } } - To create a python gtk widget from a C gtk widget: pygobject_new((GObject*) widget); If a python wrapper for 'widget' already exists, it will incref and return that, other wise it will create a new python wrapper object. - To get a pointer to the underlying C widget from a Python widget that was passed as an argument, do something like this: PyGObject *py_widget; GtkWidget *widget; if (!PyArg_ParseTuple(args, "O!", PyGObject_Type, &py_widget)) return NULL; widget = GTK_WIDGET(py_widget->obj); You might also want to look at the 'codegen' stuff that pygtk uses to automatically generate most of the pygtk interface. Once you get used to using it, it's much easier to use than writing everything by hand. -- Tim Evans Applied Research Associates NZ http://www.aranz.com/ ___ 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] My menubar disappear with mysql
Le Tue, 4 Nov 2003 12:15:12 +1300 David Moore <[EMAIL PROTECTED]> écrivait : > Hi, > > Are you using an ItemFactory? Do you keep a reference to it? Thanks for your reply Yes, I use ItemFactory, I have only imitate the example in the pygtk-tutorial. What do you mean by "keep a reference" ? How can I do that ? Your idea is good, I have replace ItemFactory by 'hard' method and my menubar is always visible Ouf, an impossible problem has a answer (of course !) but I can't more understand the link between ItemFactory and MySQLdb ! Thanks very much Who said amways at the end of the clip "I am happy" ? -- Marie-Claude Collilieux Bretagne -- Marie-Claude Collilieux Bretagne ___ 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] pyGtk/C extension
On Wed, Nov 05, 2003 at 04:22:16PM +0100, Tobbi wrote: >Example: > >Python: >button = gtk.Button() >C: >gtk_widget_destroy(button) Actually, the Python counterpart is button.destroy() >I've found some solution speaking about "_o" field of pyGtk object. This is only exposed in PyGTK 0.6, which isn't what you're using. We used to have a pure Python wrapper around the GTK+ object; this is no longer true. >However my object doesn't seem to have such pointer. Also, the >descriptions speak about gtk.GtkButton instead of gtk.Button. Old docs. >So, is there a way to get pointer to wrapped pygtk object? Do you mean the wrapped GTK+ object? If so, yes, at the C level. > Is there a way to create pygtk wrapper to already existing gtk object? Yes, though only at the C level in PyGTK-2.x+. Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331 ___ 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] pyGtk/C extension
Hi, I'm actually developing an application standing at Gtk having two parts - Ansi C and Python. The problem I met is how to get a C pointer of Gtk object relating to Python pyGtk object and vice versa. Example: Python: button = gtk.Button() C: gtk_widget_destroy(button) I've found some solution speaking about "_o" field of pyGtk object. However my object doesn't seem to have such pointer. Also, the descriptions speak about gtk.GtkButton instead of gtk.Button. Is it version mismatch? I'm using pygtk-2.0 and python 2.2.x So, is there a way to get pointer to wrapped pygtk object? Is there a way to create pygtk wrapper to already existing gtk object? Thanks very for help. Tobbi ___ 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] Py_Shell.py
Hi John, yes I know, Py_Shell does not handle correctly pasted text or drag&drop, sorry :-( Theese are features that I must implement. Next version will have theese capabilities but don't expect it in the near future because I'm busy with my thesis now. I hope to do it within weeks but I'm not sure... Best regards! Pier Il mer, 2003-11-05 alle 14:23, John Hunter ha scritto: > > "Pier" == Pier Carteri <[EMAIL PROTECTED]> writes: > > Pier> I attached a new version of Py_Shell that fix a couple of > Pier> problem: - avoid duplicated entry into the autocompletetion > Pier> list - the width of the autocompletation popup is calculated > Pier> with respect to the length of the strings This version > Pier> requires pygtk 2.0 due to some function (pango.PIXELS) not > Pier> present in previous release (at least 1.99.16) > > I Pier -- your shell looks quite nice. I use Jon Anderson's > interactive shell with my pygtk plotting library - > http://matplotlib.sourceforge.net. One thing I have been dissatisfied > with, which perhaps you know how to address, is the pasting of > formatted blocks of code into the shell. Eg, on my system (RHL9), if > I mouse-2 paste the following > > class Base: > def __init__(self): > print 'hi' > > b = Base() > > into the python shell it works fine, but if I paste it into Py_Shell > or Jon's shell, I get the error Base not defined. > > Any ideas? > John Hunter > ___ > pygtk mailing list [EMAIL PROTECTED] > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ -- Pier Carteri <[EMAIL PROTECTED]> ___ 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] Py_Shell.py
Hi Yang, I'm not sure to undestand well you question (feel free to correct me). There are two possibilities: the former is use Py_Shell to load your program, but this way can be really difficult especially if the program you load is a gui (with gui I mean something that call the gtk.main_loop) because the second call to main_loop will freeze the Py_Shell interface; a lot of work should be done to avoid possible deadlock etc., and this is a bit out of scope for Py_Shell. The latter way is create your gui which embed Py_Shell and pass to the shell a local dictionary. I'm going to explain last sentence (that's not clear also to me :-)) Py_Shell is based on InteractiveConsole (IC) (InteractiveConsole and InteractiveInterpreter are located into the code module, you can see the python doc for more infos). When you create an IC object you can pass it a dictionary; every command send to the IC will be executed into the environment based on that dictionary so this is probably what you are looking for . So try somethings like this: in Py_Shell change the line where it's created the InteractiveConsole (around line 287) self.core=code.InteractiveConsole() and replace with self.core=code.InteractiveConsole(locals()) Hope this helps Best regards! Pier Il mar, 2003-11-04 alle 23:55, Yang Zheng ha scritto: > Hello Pier, > > That fixed my problem, thanks a lot for your program and help! > > I know this is going to be a bit out of scope of the GUI, but I was > wondering if it's possible for this Py_Shell to be the original shell > that is used to load up the gui in the first place. Say I have this > Gui.py that loads up functions, variables, and the glade stuff. When I > run it, the gui pops out, with your Py_Shell embedded inside. > Currently, the Py_Shell inside the gui is a completely new one that has > no knowlege of the Gui.py functions/variables. Is there a way for > Py_Shell to have acess to them? > > thanks again, > ~ Yang > > > On Tue, 2003-11-04 at 11:46, Pier Carteri wrote: > > Hi Yang! > > main_shell=Py_Shell.Shell_Gui(with_window=0) > > > xml.get_widget("vpaned1").add2(main_shell.gui) > > > > I've looked to my code, I think the solution is that you miss a > > main_shell.gui.show_all() > > In my code I call it with the empty frame, that's why you see only the > > frame. > > You ca fix it: > > put line 313 " frame.show_all()" after line 314 "frame.add(box)" > > > > > >>> import pygtk > > > >>> pygtk.require('2.0') > > > Traceback (most recent call last): > > > File "", line 1, in ? > > > File "pygtk.py", line 73, in require > > > assert versions.has_key(version), \ > > > AssertionError: required version '2.0' not found on system > > > > It seems that somethings is wrong with your configuration; are you sure > > you have installed pygtk into the right location? The script doesn't > > find the required version of pygtk > > > > Hope this help! > > > > Best regards! > > > > Pier > > > > ___ > > 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/ -- Pier Carteri <[EMAIL PROTECTED]> ___ 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] Py_Shell.py
> "Pier" == Pier Carteri <[EMAIL PROTECTED]> writes: Pier> I attached a new version of Py_Shell that fix a couple of Pier> problem: - avoid duplicated entry into the autocompletetion Pier> list - the width of the autocompletation popup is calculated Pier> with respect to the length of the strings This version Pier> requires pygtk 2.0 due to some function (pango.PIXELS) not Pier> present in previous release (at least 1.99.16) I Pier -- your shell looks quite nice. I use Jon Anderson's interactive shell with my pygtk plotting library - http://matplotlib.sourceforge.net. One thing I have been dissatisfied with, which perhaps you know how to address, is the pasting of formatted blocks of code into the shell. Eg, on my system (RHL9), if I mouse-2 paste the following class Base: def __init__(self): print 'hi' b = Base() into the python shell it works fine, but if I paste it into Py_Shell or Jon's shell, I get the error Base not defined. Any ideas? John Hunter ___ 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] TreeViewColumn title alignment
On Wed, Nov 05, 2003 at 01:11:46AM -0500, David Bernard wrote: > > column.set_alignment(1) > > treeview.append_column(column) > > ..and everything is ok but, I want to use this instead: > > > treeview.insert_column_with_attributes(-1, title, renderer, text=0) > > ..now how can I set the alignment? Thanks. http://www.gnome.org/~james/pygtk-docs/class-gtktreeview.html#method-gtktreeview--insert-column-with-attributes gtk.TreeView.insert_column_with_attributes def insert_column_with_attributes(position, title, cell) Returns: The number of columns in tree_view after insertion. So: i = treeview.insert_column_with_attributes(-1, title, renderer, text=0) col = treeview.get_column(i-1) # column indexes start at zero col.set_alignment(1.0) Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331 ___ 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] default path for a gnome file entry
On Wed, Nov 05, 2003 at 09:04:53AM +0100, Frederic Gobry wrote: > > What do you mean by "an empty Entry"? > > An entry with no text in it: if there is no text in the entry widget, > the default directory is not used when one clicks on the Browse > button. Sounds like a bug to me. Have you checked bugzilla.gnome.org? It is likely to be at the C level, but we could be doing something wrong in the wrapper (I doubt it though). If you do report a GNOME bug, it would help to have a C testcase :-) Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331 ___ 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] Please, supply us with a set of bindings for the gnome-db widgets.
Alle 23:08, martedì 4 novembre 2003, Christian Robottom Reis ha scritto: > You're unable? Oh, you must have downloaded a binary version of PyGTK. > I recommend you pick up the source code, too -- we'll let you have a > copy free of charge > > (And we'd love to receive contributed patches for gnome-db support to > gnome-python, of course.) Unfortunatley, I'm not a C programmer (no matter if you mean a "skilled" or "absolute beginner" C programmer) so I cannot put my hands into the (Object Oriented!) C code of gnome-db and get any working Python module from it. Much less, I could create any PyGnomeDB module that could be used by other people with confidence. I do depend on other people for tasks like that. Sorry, but I can just help with (not very complex) Python-based code. CU -- Alessandro Bottoni [EMAIL PROTECTED] ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Docs (was Re: [pygtk] How to remove a row from a GTK.ListStore?)
> Do note that both the official reference and the FAQ have evolved > quite a lot over the last year, and I wouldn't call our current > documentation"poor", even if it isn't *that* easy to find. We're > trying to address this aspect of the problem, by the way. > As a newcomer to python I was pleasantly surprised by how good the docs were. I've had a steep learning curve and so far, a combination of the tutotial, the reference and the FAQ have answered all the questions I've had. And as for finding them - a google search for "pygtk" brings up the tutorial (at moeraki.com) and the FAQ on the first page. A link from the tutorial to the reference would be nice though. Regards, Chris ___ 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] default path for a gnome file entry
> What do you mean by "an empty Entry"? An entry with no text in it: if there is no text in the entry widget, the default directory is not used when one clicks on the Browse button. Frédéric pgp0.pgp Description: PGP signature ___ 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] My menubar disappear with mysql
On 4/11/2003 6:30 AM, mc collilieux wrote: Hello, I would continue a programm beginned with pygtk 1.99.13 and python 2.2 (which was working well) with python 2.2.2 and pygtk 2.0 and it is crazy... I have a top level window with : vbox ---vbox -- a menubar ---vbox -- a notebook Each choice of menu call a module which open and write a new page of Notebook and when inside this module, there is a onnection to MySQLdb, my menu is eaten by the new page of notebook. If my module has a line "import MySQLdb" but no connexion requested, it is good, but if the module as a line "from %ySQLdb import *", without connection, it eat my menubar ! I can't understand the link between my menu and mysql ! I have try MySQLdb 0.9.1, 0.9.2 and 0.9.3 test, it is the same thing. Please, an idea ? The only thing I can think of is that when you import MySQLdb, the Python garbage collector gets run, causing some unreferenced object to get collected (in this case, probably a gtk.ItemFactory). You can easily check this by replacing the import statement with "import gc; gc.collect()" James. -- Email: [EMAIL PROTECTED] WWW: http://www.daa.com.au/~james/ ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/