MVC in wxPython HELP!

Diez B. Roggisch deets at nospam.web.de
Wed Jan 11 12:11:35 EST 2006


meonimarco at gmail.com wrote:

> Hi to all.
> I woud implement MVC with wxPython. Is it possible? Is there anyone
> that have experience in this?
> The only correct example according to Observer Pattern that i  found on
> web is not the formal implementation of MVC (is Document/View) and is
> implemented with gtk...
> How can i translate this gtk example in wx?
> Does exist a tutorial, a archive of example or anything about MVC in
> wx?
> Thanks all!
> Sorry for my "italian" english!

The problem here is that MVC is not a "thing" (or class or whatever) that
can demonstrated once and for all, but a design concept for
GUI-applications.

You can do MVC in _all_ toolkits, and html, and even ncurses. Some toolkits
have "support" built-in in the way that their more complex widgets - like
tables or treeviews - expect a so-called model. That means that instead of
having e.g. a table-row-object that you add to a table and that you fill,
the table will query your model with an interface like this:

class TableModel:
   def __len__(self):
      ....

   def column_count(self):
      ....

   def get_value(self, row, column):
      ....


I have very limited experience with wx - but short googling reveals e.g. 

wx.lib.mvctree

Note the (Basic)TreeModel

Basically, you should try and look for wx(Python)-examples that use tree or
list widgets.

Regards,

Diez





More information about the Python-list mailing list