This post originated from an RSS feed registered with Python Buzz
by Hans Nowak.
Original Post: Wax 0.2.28: properties, autoevents, and more
Feed Title: Efectos Especiales
Feed URL: http://www.zephyrfalcon.org/weblog2/rss.xml
Feed Description: Ramblings, rants, musings, ideas and observations. Topics include (but are not limited to): programming (especially Python), books, games (especially CCGs and board games), astrology, design, writing, painting, etc.
OK, after considering people's comments about the so-called property parameters, I've decided to allow a single parameter properties in a constructor call. This parameter takes a dict and is used like this: from wax import * myproperties = { 'Size': (300, 150), 'BackgroundColor': 'white', } class MainFrame(VerticalFrame): def Body(self): # Method 1: Set properties through constructor p1 = Panel(self, border='sunken', properties=myproperties) self.AddComponent(p1, expand="both", border=5) # Method 2: Set properties through SetAttributes() p2 = Panel(self, border='raised') self.AddComponent(p2, expand="both", border=5) p2.SetAttributes(**myproperties) self.BackgroundColor = p1.BackgroundColor self.Pack() app = Application(MainFrame) app.Run() So, in spite of my earlier plans, you *cannot* do: b = Button(parent, Size=this, BackgroundColor=that) # XXX not allowed The WaxObject.SetAttributes method was already available, and it can be used to set properties (or other attributes) as well. ... [696 words]