addFoo, drawFoo, fillFoo
Magnus Lie Hetland <[email protected]>
| Newsgroups | gmane.comp.python.anygui.devel |
|---|---|
| Message-ID | <[email protected]> |
I've been thinking a bit about the addFoo methods (such as Menu.addCommand) and I think perhaps the fact that they don't let you give any layout arguments etc. is OK. They will be shortcuts that are mainly meant for other things (such as menu items, and, as I'll get to in a minute, drawing components) but to place things you can always use absolute coordinates; e.g: win.addButton(text='foobar', geometry=(0, 0, 100, 10)) Of course, if we introduce layout attributes in the components, you could do stuff like win.addButton(..., hstretch=True) etc. too... Anyway, this sort of thing is also suited (I think) to the graphics API. Let's say the basic API is like this: circle = Circle(center=(0,0), radius=10, stroke=1) canvas.add(circle) Then you could use the following as a shortcut: canvas.addCircle(center=(0,0), radius=10, stroke=1) or even canvas.drawCircle(center=(0,0), radius=10) If, instead of stroke=1 we have fill=1 (not sure about this detaul -- I was just thinking of Boolean flags here) then we could use canvas.fillCircle(center=(0,0), radius=10) as another shortcut. This leaves us with a straightforward drawing API, yet the core API is still as simple as before, using properties and containment (through add()). -- Magnus Lie Hetland The Anygui Project http://hetland.org http://anygui.org ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf