"Chandan Pitta" wrote: > More questions (sorry I decided to use my weekend to understand candy). I am > trying to create a grid of Text widgets, but Grid requries a template. What > is that? Can't I simply pass None?
A grid _does_not_ take a list of widgets to be shown, it gets a list of something (e.g. in Freevo a Menu object) and iterates over this list and creates the widgets. To do that it need a template how to create widgets from it. Look at flickr.py, the list of of type Image(object) with a title and a thumbnail attribute. You can create a template by calling the class function create_template. This is a thread-safe function which creates an object that can create a widget. This template is used for all cells in the grid. | template = Text.create_template(text=..., font=..., color=..., align=...) It is a bit complicated, I know. It is much easier if you use the xml based definition, in that case you always create templates. > grid = Grid(None, (100,500), (100, 100), "item", items, None, > SelectableGrid.VERTICAL) > self.stage.add(grid) SelectableGrid .... maybe you also want to take a look at freevo/WIP/gui/gui/widgets/listing.py. > Also the doc string for Grid says that you can use None for size, but that > is wrong. It requires values because it calculates number of row and cols. Ooops, that is wrong. Dischi -- People say I'm a bad influence. I say the world is already pretty messed up - I'm just adding to it. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel