MVC in Python

Tertius tcronj at ananzi.co.za
Wed Aug 6 17:25:49 EDT 2003


MK wrote:
> In Java, I simply register many listeners with a data model.
> Whenever the model changes, all the listeners are notified
> and they change their GUI elements accordingly and
> automatically.
> 
> How to achieve this feat in Python? Which techniques
> do you guys use?
> 
> Say you have one data structure and two tree controls
> in wxPython, displaying two perspectives of that same
> data structure. How would you proceed, that is, implement
> an equivalent, MVC-ish mechanism, in this case?
> My first knee-jerk reaction would be: implement two functions,
> update_tree_1() and update_tree_2() which "intelligently"
> update only the critical parts of tree GUI control and
> which are being called by the data structure whenever
> it (data structure, that is) changes.
> 
> MK,
> coming from a patterns-ridden Java world
> 
> 

Check out ..\wxPython\lib\pubsub.py






More information about the Python-list mailing list