API idea (addFooBar)

Magnus Lie Hetland <[email protected]>
Newsgroups gmane.comp.python.anygui.devel
Message-ID <[email protected]>
Just a generalisation of Joe's addCommand etc. How about expanding the
alias mix-in to include add-shortcuts like this in general? So that
foo.addBar(x=y) is an automatic shortcut for

  temp = Bar(x=y)
  foo.add(temp)
  return temp

?

We have one problem: How to discern between arguments to the class
constructor and arguments to add. (I guess that's pretty critical,
actually...) Perhaps all arguments could be sent to both...? (Somewhat
desperate solution, I guess...) Alternatively, this version could work
only for add() without any keyword arguments. In that case we'd need
some way of supplying that info (layout) later (or controlling it
through some component attributes).

It just strikes me as nicer to have this as a general thing than to
have it only apply to Menus.

And another thing: I really think win.add(menubar) should be possible,
even if it involves checking for 'MenuBar'ness in add().
win.addMenu(menubar) seems like a sore thumb. (win.addMenuBar() would
still work as a shortcut if we can get that sort of thing working in
general, of course).

-- 
Magnus Lie Hetland                                  The Anygui Project
http://hetland.org                                  http://anygui.org


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.