Ed Leafe <[EMAIL PROTECTED]> writes:

>       We do - the base class is dFont, and every control that has a  
> displayed font uses this. The separate Font* properties are  
> convenience properties; many times you just want to bump up the font  
> size to 16 points, but leave the rest. Which code is simpler:
> 
> fnt = obj.Font
> fnt.Size = 16
> obj.Font = fnt
> 
> -or-
> 
> obj.FontSize = 16

Why not:
obj.Font.Size = 16
 
> > That would seem more intuitive to me - changing the properties of  
> > the font, rather than each object having a separate property for  
> > each font characteristic. Such a design would also allow simple  
> > copying of fonts from one object to another, which can be useful.
> >
> > I imagine you made this design decision after some thought, so I'd  
> > be interested to hear the rational behind it.
> 
>       Simple things should be simple, but complex things should not be too  
> difficult, either.
> 
>       Let's say you had a label and a text box, and wanted them to have  
> the same font qualities. So you create a dFont instance, set it the  
> way you want, and then write:
> 
> lbl.Font = txt.Font = myFontInstance
> 
>       Then later in the code you write:
> 
> lbl.FontSize = 20
> 
>       Since both objects use the same font object, the textbox will *also*  
> change to 20 points. Cool, huh?

Yes, Python is cool :) j/k, it's awesome that Dabo makes these things Pythonic,
even though the underlying framework is not.

Still, having -too many- "magic" properties can be confusing. I would prefer
getting to anything font-related through a Font property than directly, even if
the functionality is the same. But, that's just me, and this is mostly a style
issue. Still, since TIOOWTDI is considered Pythonic, this does seem somewhat
un-Pythonic...

- Tal



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]

Reply via email to