up with PyGUI!

Brendan Barnwell brenbarn at brenbarn.net
Sat Sep 25 01:12:46 EDT 2004


On Fri, 24 Sep 2004 11:08:22 -0300 Carlos Ribeiro
<carribeiro at gmail.com> wrote:

> I think I have solved the first half of your problem. Please check my
> "Call for suggestions" post from yesterday. I implemented a
Container
> metaclass that can take nested class declarations and generate a
> representation with a few important features:
>
> -- it's ordered (in the same order as the original declarations in the
> source code)
> -- all nested classes are converted to instances

	My implementation essentially does this as well.  However, I
have devised a metaclass (called ClassObj) that does not actually
replace the class with an instance.  Instead, each class keeps a reference
to singleton instance.  All attributes are stored on the class object, but
methods are forwarded to the instance (since Python won't allow you
to call methods on a class).  The advantage of this is that the classes
can even be subclassed.  This metaclass largely eliminates the
distinction between classes and objects; a ClassObj can effectively
function as either.

> Please check it, and let me know if you're interested. I'm focusing my
> work on this part now, I'm purposefully not dealing with the GUI; I
> have my own ideas regarding the GUI part, but let us solve one
problem
> at a time, right?
<snip>
> It seems like we're looking for similar solutions. I'm looking for
> more people to start a separate discussion to avoid spamming c.l.py.
> Please drop me a note if you're interested.

	I'm definitely interested.  I have put my work-in-progress code up
if you want to look at it.  It is at http://www.brenbarn.net/misc/gui/
(You may have to change the import statements in the files slightly; I
haven't bothered to make sure the directory structure there is the same
as on my local system.)  This is obviously incomplete, but it gives an
idea of the kind of thing I am doing.  Let me know what you think!

--
--Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is
no path, and leave a trail."
	--author unknown




More information about the Python-list mailing list