Re: up with PyGUI!
From: OKB (not okblacke) (brenNOSPAMbarn_at_NObrenSPAMbarn.net)
Date: 09/25/04
- Next message: Richard Hanson: "Re: [OT] "Pre-announcement" of Python-based "computing appliance" project."
- Previous message: Richard Hanson: "Re: [OT] "Pre-announcement" of Python-based "computing appliance" project."
- In reply to: Ed Leafe: "Re: up with PyGUI!"
- Next in thread: Ed Leafe: "Re: up with PyGUI!"
- Reply: Ed Leafe: "Re: up with PyGUI!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Sep 2004 19:47:59 GMT
Ed Leafe wrote:
> There is also nothing to prevent you from writing that button as a
> class definition (although I have a personal dislike of a 'class'
> being used for an instance). Something like:
>
> class MainForm(dabo.ui.dForm):
> def __init__(self, parent=None):
> class btn1(ButtonDescription):
> Size = (40, 40)
> Caption = "b1"
> self.addObject(btn1, "b1")
>
> To my eye, that's a lot uglier than writing it as it is:
> instance
> coding. Dressing it up as a class in order to save typing 'self'
> isn't justified, IMO.
Well, I see what you mean, but conversely, even in the example you
gave above, it seems to me that the "def __init__" is (or should be)
superfluous. The very fact that you are defining a button inside a
panel clearly indicates that you want the button to be added to the
panel. Restating this information repeatedly with an __init__ and self
references and explicit "add" methods is cumbersome.
Admittedly, the need to use the word "class" is unfortunate, but I
prefer to simply ignore that little keyword in the definition. That is,
what about this:
frame:
panel:
button1:
caption = "One"
button2:
caption = "Two"
I think the indentation here clearly indicates the intended nesting
structure of the GUI layout. Python requires me to use the word "class"
before each component to get a valid syntactical construct, but I find
it much easier to put single keyword ahead of each GUI object definition
than to wade through a series of method definitions to extract
information about how the components are structured inside one another.
-- --OKB (not okblacke) Brendan Barnwell "Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail." --author unknown
- Next message: Richard Hanson: "Re: [OT] "Pre-announcement" of Python-based "computing appliance" project."
- Previous message: Richard Hanson: "Re: [OT] "Pre-announcement" of Python-based "computing appliance" project."
- In reply to: Ed Leafe: "Re: up with PyGUI!"
- Next in thread: Ed Leafe: "Re: up with PyGUI!"
- Reply: Ed Leafe: "Re: up with PyGUI!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]