python


tkinter Model-View-Controller: deeply-nested widgets calling the controller


I'm refactoring a tkinter GUI along a MVC design pattern. The Controller module imports a View class, and the View class makes requests to the Controller. I have a few ways of registering a change to an entry widget (StringVar trace, binding, etc.), but what if the widget is deeply nested and the callback is at a much higher level? What is the best way to have a request propagate upwards? For example, what if the View has a Frame that has a Frame that has a Widget that changes status?
The two solutions that occur to me are:
Russian Doll approach: Every inner layer is instantiated with either a reference to the View or the Controller, so the widget can directly make a request (e.g. to ViewReference.call_controller(input), or ControllerAlias.request(input). This leaves a trail of breadcrumbs from View to widget.
Family Tree approach: recursively call the parents and ask if they have an "ask controller to do thing" method. If not, ask their parents. This seems more fragile and awkward.

Related Links

Cheking added file to upload python, pylons?
How to refer to the local module in Python?
Is close() necessary when using iterator on a Python file object [duplicate]
Django Admin “Edit Selection” Action?
How to change firefox proxy from webdriver?
Is it possible to hook up a more robust HTML parser to Python mechanize?
Enable Unicode “globally” in Python
Dynamically import a callable given the full module path?
python chaining
py2app and xml.etree.ElementTree
What is the difference between isinstance('aaa', basestring) and isinstance('aaa', str)?
Is this essential functional programming feature missing from python?
Hooking into a wave-out on different platforms
What causes subprocess.call to output blank file when attempting db export with mysqldump?
How do I remove something form a list, plus string matching?
Reference to Part of List - Python

Categories

HOME
dotnetrdf
app-inventor
tinyos
voip
webrtc
otrs
bibtex
h2
appmaker
azureservicebus
specflow
branch.io
file-io
height
hosts
cakephp-2.9
rfid
iso
cortex-a
abcpdf
react-leaflet
eclipse-luna
lenskit
google-openid
jive
fop
delete-file
npm-install
pdfsharp
shopping-cart
widevine
classpath
hana-studio
pitest
jboss5.x
xor
referenceerror
protobuf-net
backup-strategies
spreedly
honeysql
rider
bigcartel
elfinder
xbim
jrules
excel-interop
3scale
vcf
amazon-machine-learning
rhel6
chrome-remote-desktop
rpostgresql
launch
iphone-developer-program
build-process
mongoose-populate
spark-cassandra-connector
multiple-file-upload
dbscan
codesign
magento-1.4
jta
android-snackbar
integral
calibration
xjc
uos
adobe-indesign
ember-components
jstat
author
humanizer
phpdocx
dynamic-proxy
baucis
jquery-tabs
haskell-platform
manage.py
client-library
pascals-triangle
linkedhashset
radchart
tfs-power-tools
flash-cs5.5
coff
qtembedded
testunit
windows-live-id
collect
for-xml-path
symbol-server
loadui
hardware-acceleration
sitemappath
gwt-2.2-celltable
jquery-ui-button
windows-controls
microsoft.ink
soft-keyboard
usergroups

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App