Re: [pygtk] Notebook tab functions
On Sun, May 26, 2002 at 08:50:03AM -0600, Collins wrote: > Is there a way to code a python function that receives an object that > can be invoked in that function, i.e. the equivalent of passing in a > pointer to funtion in C code and invoking that function or passing its > address to another function. Yes, of course; all functions in Python are objects and can be passed normally as parameters. > Something like the following code snippet. > > def callback(widget,entry) : > pass > > def function(rtn1) : > . . . > b2 = GtkRadioButton(label="Full list") > b2.connect("pressed", rtn1, b2) > ... > > ... > function(callback) > ... Will work, haven't you tried it? Take care, -- Christian Reis, Senior Engineer, Async Open Source, Brazil. http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL ___ 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] Notebook tab functions
That, or something like it, should work. Have you tried it? On Sun, 2002-05-26 at 10:50, Collins wrote: > Is there a way to code a python function that receives an object that > can be invoked in that function, i.e. the equivalent of passing in a > pointer to funtion in C code and invoking that function or passing its > address to another function. > > Something like the following code snippet. > > def callback(widget,entry) : > pass > > def function(rtn1) : > . . . > b2 = GtkRadioButton(label="Full list") > b2.connect("pressed", rtn1, b2) > ... > > ... > function(callback) > ... > > > > -- > Collins Richey - Denver Area - WWTLRD? > gentoo(since 01/01/01) 2.4.18+(ext3) xfce-sylpheed-mozilla > ___ > 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] Notebook tab functions
This is more of a python question than a pygtk question, but I've been unable to sort it out with my python books and several google searches. I have created a notebook than creates two tabs to display the contents of two different directory structures (installed packages and packages available for install). Each tab is identical except for the need to bind to different methods to handle the different directory structure for each. Right now I have the code duplicated to create each tab, and all is cool, but it would be nice to be able to collapse the duplicated code into a common function that I can invoke with the actual connection functions passed in. Is there a way to code a python function that receives an object that can be invoked in that function, i.e. the equivalent of passing in a pointer to funtion in C code and invoking that function or passing its address to another function. Something like the following code snippet. def callback(widget,entry) : pass def function(rtn1) : . . . b2 = GtkRadioButton(label="Full list") b2.connect("pressed", rtn1, b2) ... ... function(callback) ... -- Collins Richey - Denver Area - WWTLRD? gentoo(since 01/01/01) 2.4.18+(ext3) xfce-sylpheed-mozilla ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/