Re: GdkColor : the phantom class ?

2006-04-14 Thread Thomas Girod
I found an answer : color = gtk.gdk.Color() and then use color for fg et bg -- http://mail.python.org/mailman/listinfo/python-list

GdkColor : the phantom class ?

2006-04-14 Thread Thomas Girod
Hi. No matter how I try, I just can't find this GdkColor class. I'm trying to convert some data into a pixmap in order to display it. Here is my code : import pygtk pygtk.require('2.0') import gtk xbm = """#define dump_width 4 #define dump_height 4 static unsigned char dump_bits[] = { 0xaa, 0x6c,

create pixmap from data

2006-04-14 Thread Thomas Girod
Hi there. I have a list containing integer values from 0 to 255. With this list I have informations width and height, as width * height = len(my_list) What I want to do is to convert this array into a pixmap of dimension width * height in order to draw it inside a pygtk GUI. Any suggestions abou

Re: new-style classes and len method

2006-04-13 Thread Thomas Girod
It's alright I found where my mistake came from. I was misunderstanding the meaning of "classmethod", thinking of it as an instance method. -- http://mail.python.org/mailman/listinfo/python-list

Re: new-style classes and len method

2006-04-13 Thread Thomas Girod
Or maybe I'm mixing up what we call a "classmethod" with what we could call an "instance method" ? -- http://mail.python.org/mailman/listinfo/python-list

new-style classes and len method

2006-04-13 Thread Thomas Girod
Hi there. I'm trying to use new-style classes, but there is something i'm obviously missing here it is : class Data(list): __slots__ = ["width", "height", "label"] def __init__(self,width,height,label=None): list.__init__(self) self.width = width self.height = he

Re: read a file line by line using readline()

2006-03-22 Thread Thomas Girod
If your code is exactly what you've copy-pasted, then you are not testing against an empty string but a "one blank space" string ... I've just tried with : while line != "": and it works very well. -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple inheritance

2006-02-16 Thread Thomas Girod
That's perfect. thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple inheritance

2006-02-16 Thread Thomas Girod
thanks, you pointed exactly on what distrurbed me. I'll see what I can do with cooperative methods. -- http://mail.python.org/mailman/listinfo/python-list

multiple inheritance

2006-02-15 Thread Thomas Girod
Hi. I think I'm missing something about multiple inheritance in python. I've got this code. class Foo: def __init__(self): self.x = "defined by foo" self.foo = None class Bar: def __init__(self): self.x = "defined by bar" self.bar = None class Foobar(Foo

Code organization

2006-02-15 Thread Thomas Girod
Hi. I found a lot of documentation about how to code in Python, but not much about how you organize your code in various modules / packages ... As I am not yet used to python, this puzzle me a bit. So, can anyone explain how one should organize and store its code ? the uses of __init__.py files ?

Re: listing attributes

2006-02-14 Thread Thomas Girod
You are right, using __dict__ is what i needed. But I chose the solution explained before because i don't want to list all attributes of the object, only attributes that are instances of the class Property (or a subclass of it). -- http://mail.python.org/mailman/listinfo/python-list

Re: listing attributes

2006-02-14 Thread Thomas Girod
Thanks a lot for all your answers ! Thanks to you I resolved this problem. Here is what i've done : [...] for (_,v) in getmembers(self): if isinstance(v,Property): st += "\t%s\n" % str(v) [...] as all the attributes I want to get are instances of Property or a subclass of Property,

listing attributes

2006-02-13 Thread Thomas Girod
Hi there. I'm trying to get a list of attributes from a class. The dir() function seems to be convenient, but unfortunately it lists to much - i don't need the methods, neither the built-in variables. In fact, all my variables are referencing to objects of the same type. Can anyone suggest me a w

Re: variables preceeded with @

2006-02-07 Thread Thomas Girod
Yum, food for thoughts. Thanks Diez. -- http://mail.python.org/mailman/listinfo/python-list

variables preceeded with @

2006-02-07 Thread Thomas Girod
Hello there. I recently started looking at turbogears and I found code such as : class Root(controllers.Root): @turbogears.expose(html="blog.templates.accueil") def index(self,**kw): return dict() What is this "@" ? I looked around but couldn't find any references to this sy